TweepError On Simple Tweepy Bot转发私人清单

时间:2017-10-20 22:48:35

标签: python twitter tweepy

所以我正在制作一个简单的Tweepy机器人,从该帐户的私人推特列表转发推文。机器人似乎在Twitter上工作,但它仍然在终端中抛出这个错误:

  File "test.py", line 17, in <module>
    api.retweet(tweet.id)
  File "/Users/username/anaconda/lib/python3.6/site-packages/tweepy/binder.py", line 245, in _call
    return method.execute()
  File "/Users/username/anaconda/lib/python3.6/site-packages/tweepy/binder.py", line 229, in execute
    raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: [{'code': 327, 'message': 'You have already retweeted this tweet.'}]

有什么想法吗?当列表变得太大时,我也在努力清除我存储所有先前转发的列表。谢谢!

以下是代码:

tweets = api.list_timeline('username', 'username-list')
tweeted = []

while True:
    for tweet in tweets:
        if tweet.id not in tweeted:
            api.retweet(tweet.id)
            tweeted.append(tweet.id)
        elif tweet.id in tweeted:
            pass

0 个答案:

没有答案