检索用户时间轴时超出了tweet速率限制



我正在尝试使用Tweepy的user_timeline模块从Twitter用户列表中获取tweet。然而,我一直得到错误信息说"速率限制超过"。我已经阅读了Twitter关于速率限制的文档,并且非常确定我没有超过它。

我的代码节选:

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)

我还打印出了tweepy的api。Rate_limit_status,正如预期的那样,它显示user_timeline的限制已被超过。但推特的文件显示,限制是每15分钟180个窗口。我认为我没有超过这个标准。

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

有人能帮忙吗?

当您建立API实例时,包括wait_on_rate_limit参数(文档显示,它默认为False)。您还可以添加notify参数,以便您知道何时接近极限。http://docs.tweepy.org/en/latest/api.html

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

最新更新