Tweepy speed limit exceeded when getting user timeline

I am trying to get tweets from a Twitter user list using the Tweepy user_timeline module. However, I keep getting the "Speed ​​limit exceeded" error. I've read Twitter's documentation on rate limiting and I'm pretty sure I haven't exceeded it.

Output of my code:

auth = tweepy.OAuthHandler(apikey, apisecret)
auth.set_access_token(AccessToken, AccessTokenSecret)
api = tweepy.API(auth)

user_list = [] #a list of 10 users
for user in user_list:
    tweets=tweepy.Cursor(api.user_timeline,id=user).items(10)

      

I also printed out tweepy api.rate_limit_status and as expected it shows that the limit for user_timeline has been exceeded. But the documentation on Twitter states that the limit is 180 per 15 window minutes. And I don't think I have exceeded it.

'/statuses/user_timeline':{  
        'reset':1438149614,
        'limit':180,
        'remaining':0

      

Can anyone please help?

+3


source to share


1 answer


When you set up your API instance, include the wait_on_rate_limit parameter (documents shown are rendered by default False). You can also add a notification option so you know when you're nearing your limit. http://docs.tweepy.org/en/latest/api.html



api = tweepy.API(auth, wait_on_rate_limit=True)

      

+5


source







All Articles