Proper protocol for displaying user's avatar in an app

0 views
Skip to first unread message

Adam Green

unread,
Nov 22, 2009, 11:12:45 PM11/22/09
to Twitter Development Talk
I'm building a Web app that caches tweets and user info from the
streaming API, and then displays all the tweets for a single user. At
times up to 30 or 40 tweets from the same user are displayed on a
page. I've been caching the profile image url I get back from the
streaming API, and then using this URL in an img tag sent to the
browser. So I am letting the user's browser pull it from the Twitter
server as needed. I don't see anything in the API docs that warns
against this, but sometimes I am getting an "access denied" XML back
instead of the proper image. Is this a bug, or should I be downloading
each user's avatar and serving it from my server instead? The image is
being requested by the user's browser, so whilelisting the server's IP
won't help. The access denied response is intermittent. Sometimes it
happens after 5 requests for the same image, sometimes 30 appear with
no problem. Sometimes a few appear, a few fail, and then the rest
work. So it doesn't seem like rate limiting.

Dave Briccetti

unread,
Nov 23, 2009, 3:21:31 AM11/23/09
to Twitter Development Talk
I would be curious to see the details of the request and response from
Firebug, Wireshark or similar. I have never received anything other
than an image as a response. Since a browser is making the request for
the photo, it should cache it.

Abraham Williams

unread,
Nov 23, 2009, 10:26:01 AM11/23/09
to twitter-deve...@googlegroups.com
Are you seing responses like this?

<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>889C9C8DC5E6F054</RequestId><HostId>qP9kff/BDVhsRl2VGPrmanTcCxalXrdxcVwhlUNLUq5jpavHQQYmdHB4HFb2t02j</HostId></Error>

It means the account changed their avatar and your profile image URL is old.

Abraham 
--
Abraham Williams | Community Evangelist | http://web608.org
Hacker | http://abrah.am | http://twitter.com/abraham
Project | Awesome Lists | http://twitterli.st
This email is: [ ] blogable [x] ask first [ ] private.
Sent from Madison, WI, United States

vsr

unread,
Nov 23, 2009, 8:33:14 PM11/23/09
to Twitter Development Talk
Doesn't http://twivatar.org solve it?
Reply all
Reply to author
Forward
0 new messages