Twitter Rate limit exceeded. Clients may not make more than 350 requests per hour
using Tweepy in my app, I get this Exception very often, just after sending no more than 10 twetts and updating the timeline around 20~30 times.
Rate limit exceeded. Clients may not make more than 350 requests per 开发者_运维知识库hour.
To update the timeline I'm using the timeline function with a limit of 40 tweets.
So I don't what is happening here, maybe there is a different API call per twitt or something like that.
Do you have any idea of wich kind of request consume more API calls, or when is using more than one?
Any suggestion about the best way to use API calls to Twitter?
Thanks in advance.
>>> 3600./350
10.285714285714286
Only send a tweet every 11 seconds.
Here is your friend -> Twitter api rate-limiting
Spend some time reading this document.
Headers
There are some rate limit status headers returned in the responses that may help you. Consider logging them at a debug level. If your requests come from different IP's you may see different quota/usage being reported from response to response.
Whitelisting
Getting your servers IP's whitelisted may be a solution if you have many users.
Some hosting providers are whitelisted already, eg Google App Engine.
Just a hunch, but just because the limit is expressed in reqs/hr, doesn't mean it's measured or enforced hourly.
精彩评论