Avoid Twitter API limitation with Tweepy

前端 未结 5 1427
时光说笑
时光说笑 2020-11-30 21:18

I saw in some question on Stack Exchange that the limitation can be a function of the number of requests per 15 minutes and depends also on the complexity of the algorithm,

5条回答
  •  庸人自扰
    2020-11-30 22:07

    import tweepy
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)
    # will notify user on ratelimit and will wait by it self no need of sleep.
    api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
    

提交回复
热议问题