Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rate Limit Exceeded - Custom Twitter app

I am working with a java Twitter app (using Twitter4J api). I have created the app and can view the current users timeline, user's profiles, etc..

However, when using the app it seems to quite quickly exceed the 150 requests an hour rate limit set on Twitter clients (i know developers can increase this to 350 on given accounts, but that would not resolve for other users).

Surely this is not affecting all clients, any ideas as to how to get around this?

Does anyone know what counts as a request? For example, when i view a user's profile, i load the User object (twitter4j) and then get the screenname, username, user description, user status, etc to put into a JSON object - would this be a single call to get the object or would it several to include all the user.get... calls?

Thanks in advance

like image 693
rhinds Avatar asked Aug 08 '10 14:08

rhinds


People also ask

How do I fix the rate limit exceeded on Twitter?

try not to over use the refresh button - this will cost you 3 calls per click (All Tweets, Replies & DMs) UPDATE: try lowering the total % in the settings window, twitter API tab to around 60-70% - you'll get less frequent updates but you'll use less API.

Why does Twitter say rate limit exceeded?

If you get the 'rate limit exceeded' message, it's not the end of the world. It just means that Twitter will not provide any updates until the hour is up. Some aspects of Twitter will appear frozen until the new hour starts and the rate limit is reset.

How long does rate limit last on Twitter?

The most common request limit interval is fifteen minutes. If an endpoint has a rate limit of 900 requests/15-minutes, then up to 900 requests over any 15-minute interval is allowed. Rate limits are applied based on which authentication method you are using.

What is the Twitter API rate limit?

Standard API v1. You can only post 300 Tweets or Retweets during a 3 hour period. For example, if your Twitter app makes 200 requests to the POST statuses/update endpoint within a three hour period, your app will only be able to make 100 requests to the POST statuses/retweet/:id endpoint during that period.


1 Answers

You really do need to keep track what your current request count is when dealing with Twitter.

However, twitter does not seem to drop the count for 304 Not Modified (at least it didn't the last time I dealt with it), so make sure there isn't something breaking your normal use of HTTP caching, and your practical request per hour goes up.

Note that twitter suffers from a bug in mod_gzip on apache where the e-tag is mal-formed in changing it to reflect that the content-encoding is different to that of the non-gzipped entity (this is the Right Thing to do, there's just a bug in the implementation). Because of this, accepting gzipped content from twitter means it'll never send a 304, which increases your request count, and in many cases undermines the efficiency gains of using gzip.

Hence, if you are accepting gzip (your web-library may do so by default, see what you can see with a tool like Fiddler, I'm a .NET guy with only a little Java knowledge, answering at the level of how twitter deals with HTTP so I don't know the details of Java web libraries), try turning that off, and see if it improve things.

like image 118
Jon Hanna Avatar answered Sep 23 '22 02:09

Jon Hanna