我正在尝试使用此代码从我的帐户中删除 550 条推文,因为我想再次将其用作我的个人帐户,而没有来自我的机器人的推文:
import tweepy
import json
auth = tweepy.OAuthHandler("consumer_key", "consumer_secret")
auth.set_access_token("access_token", "access_token_secret")
api = tweepy.API(auth)
screen_name = "YOUR_TWITTER_HANDLE"
timelines = api.user_timeline(screen_name, count = 550, include_rts = False)
for status in timelines:
tweetid = status._json
api.destroy_status(tweetid)
但是每次我运行它时,我都会收到这个错误:
tweepy.error.TweepError: [{'message': 'Application cannot perform write actions. Contact Twitter Platform Operations through https://support.twitter.com/forms/platform', 'code': 261}]
当我打印tweetid
时,它成功地抓取了我所有的推文。我也可以正常使用 tweet api.update_status
,为什么这不起作用?我究竟做错了什么?