Reputation: 157
I have a long list of tweet id's (3200 to be exact). I am trying to collect all the retweets for all the tweets to build a network graph. Twitter limits the REST API calls for this one to 75 per 15 minute period. I am new to this, so does that mean 75 entities or I can get retweeters for 75 tweets?
In any case, how do I set up my code to not exceed the rate limit and yet go through the whole list of 3200 ids? This is what I have so far and it didn't work.
auth = tweepy.OAuthHandler('a', 'b')
auth.set_access_token('c', 'd')
api = tweepy.API(auth)
for attempt in range(75):
for x in tweet_id_list:
retweeters = []
for status in api.retweets(x):
retweeters.append(status.user.id)
time.sleep(60 * 15)
Upvotes: 0
Views: 88
Reputation: 31
Use the built-in notify functions:
auth = tweepy.OAuthHandler('a', 'b')
auth.set_access_token('c', 'd')
api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
Upvotes: 1