Edit1:代码转发用户,但我如何才能一直运行并转发最新的推文。
for tweet in tweepy.Cursor(api.user_timeline, id=25073877).items():
try:
# Add \n escape character to print() to organize tweets
print('\nTweet by: @' + tweet.user.screen_name)
# Retweet tweets as they are found
tweet.retweet()
print('Retweeted the tweet')
#Favorite the tweet
#tweet.favorite()
#print('Favorited the tweet')
time.sleep(3600) # take a sleep for in sec
except tweepy.TweepError as e:
print(e.reason) # if cant Retweet tweets, print the reason
except StopIteration:
break