小编Bar*_*ry 的帖子

使用tweepy时出现此错误

用于收集推文并将其发送到csv文件的Python代码

不断返回错误

tweepy.error.RateLimitError:[{'code':88,'message':'超出限价'}]

试图获取最新的时间轴并将所有这些推文发送到csv文件

谢谢你的帮助

def get_all_tweets(screen_name):

    #authorize twitter, initialize tweepy
    auth = tweepy.OAuthHandler(consumer_token, consumer_secret)
    auth.set_access_token(access_token, access_secret)
    api = tweepy.API(auth)

    #initialize a list to hold all the tweepy Tweets
    alltweets = []    


    new_tweets = api.home_timeline (screen_name = screen_name,count=20)

    #save most recent tweets
    alltweets.extend(new_tweets)

    #save the id of the oldest tweet less one
    oldest = alltweets[-1].id - 1

    while len(new_tweets) > 0:
        print ("getting tweets before %s" % (oldest))

        #all subsiquent requests use the max_id param to prevent duplicates
            new_tweets = …
Run Code Online (Sandbox Code Playgroud)

python csv twitter tweepy

3
推荐指数
1
解决办法
4395
查看次数

标签 统计

csv ×1

python ×1

tweepy ×1

twitter ×1