Rate Limiting 420 and 429 codes


#1

I am trying to make my code respond well to rate limiting for version 1.1.

I am getting the 420 error when I am being rate limit. But, the way I read the docs (https://dev.twitter.com/docs/error-codes-responses), the 420 error is returned by version 1.0 and not version 1.1. Shouldn’t I be getting a 429 error now that we are using version 1.1? When would I get a 429 error?

Thanks!


#2

Can you share the URLs you’re executing when you hit rate limiting and erroneously get a HTTP 420? Can you include the output of that response as well? Thanks!


#3

Is the Search API considered part of the REST API? I was looking at another post and it implies they are separate. If yes, is Search API still 1.0?

Here is the URL:
https://search.twitter.com/search.json?q=love&since_id=0&rpp=1&page=1&result_type=recent

I didn’t capture the output. If you still would like I will capture it.


#4

It is now considered part of the REST API, but the “unversioned” search.twitter.com endpoint is still the old search API until it will be turned off in March 2013.

You’ll find the new rate limit HTTP status code 429 by using version 1.1’s search api documented here: [node:10287]


#5

Hi Taylor,

I wonder why I’m getting the 429 errors regularly.
I’m checking my remaining rate limit at each query I cast.
I put a condition in my code that pause the query casting like this.

if int(t.application.rate_limit_status()[‘resources’][‘statuses’][’/statuses/show/:id’][‘remaining’]) < 2:
while int(t.application.rate_limit_status()[‘resources’][‘statuses’][’/statuses/show/:id’][‘remaining’]) < 100:
print "remaining hits: " + unicode(t.application.rate_limit_status()[‘resources’][‘statuses’][’/statuses/show/:id’][‘remaining’])
time.sleep(30)

I’m using python wrapper for twitter (twitter_1.9.0) package.
I get that 429 error when I have more than 80 remaining rate limits.

What’s the reason and how can I avoid it?


#6

Did you figure this out? I am having the same trouble.


#7

how to overcome Rate Limiting 429 error while using twitter4j library


#8

i am using url “https://api.twitter.com/1.1/search/tweets.json?q=the&geocode=28.43,77.44,1mi” with twitter4j library to fetch geolocations. But i am getting error rate limit issue.

Any help will be greatly appreciated.


#9

You don’t really overcome rate limiting, you cope with it and scope your work within it. Applications have two pools to draw from for working with the search/tweets method – a user-based context and an app-only context. You can make 180 queries per 15 minutes in the user context. You can make 450 queries per 15 minutes in the app-only context. Monitor your rate limits and manage your query executions within them.


#10

When you execute t.application.rate_limit_status() does “t” execute application/rate_limit_status each time? You might be being rate limited from checking your rate limit – you might find it better to cache the rate limit status and/or use the HTTP headers included in results to manage.


#11

Can you please clarify?
You mean if I have 10 users then my app can query 1800 in 15 min or just 450. (Those 10 users will be doing query)