python - Tweepy: Handle RateLimit in show_friendship() -
i'm trying see several friendships between 2 twitter users, , i'm using show_friendship(twitter_id_1, twitter_id_2) method tweepy library inside loop.
i wonder how can handle ratelimit or using cursor (http://docs.tweepy.org/en/v3.5.0/cursor_tutorial.html) method because after several loops raises ratelimiterror.
this ratelimit handle of search friends (people i'm following) can't figure out how same show_friendship()
def limit_handled(self, cursor): while true: try: yield cursor.next() except tweepy.ratelimiterror: time.sleep(15 * 60) friend in limit_handled(tweepy.cursor(api.friends).items()): #stuff
Comments
Post a Comment