python - 为什么我不能使用此代码删除多条推文?Python tweepy
问题描述
我正在尝试使用此代码从我的帐户中删除 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
,为什么这不起作用?我究竟做错了什么?
解决方案
似乎您已经对 twitter api 提出了许多请求 - 从我的小研究中,错误代码 261 表示令牌已暂停。检查此链接:
https://blog.cotten.io/common-twitter-error-codes-6b324396042e
推荐阅读
- android - 在 API 24+ 上使用 Uri 通过 Intent 打开文件
- java - Akka Streams + Akka 集群
- java - 正则表达式不检测空格
- pydev - 将 zip 文件附加到 pydev tracker 中的新问题
- python-3.x - paho mqtt:使用 python 3 编译时输出不正确
- node.js - 无法启动 npm/yarn
- python - 关于使用 n 排列实现 Minhash 的建议
- python - 如何使用可读的非阻塞输出管道在 Linux 上的 python 中启动 node.js 子进程
- javascript - 为什么通过 NodeJS 运行时 Tesseract 的准确度低于直接从命令行运行时的准确度?
- javascript - 如何过滤 2 个对象数组并有效地处理它?