Python Tweepy Block用户返回401未经授权

发布于 01-21 05:41 字数 248 浏览 6 评论 0原文

我正在尝试使用Python脚本和Tweepy API阻止Twitter用户。我可以毫无问题地提取用户,ID,关注者和推文。当我尝试调用api.create_block(screat_name ='<某些人我不喜欢>') 我有例外 401未经授权 (并且该用户没有被阻止)。我一直在谷歌搜索,但只发现旧帖子指的是我的Windows时间不同步。我同步时间,没有改进。我还尝试通过ID阻止,但没有运气。 有人可以帮忙吗?

I am trying to block a Twitter user using Python scripting and the Tweepy API. I am able to extract users, IDs, followers and tweets with no problem. When I try to call api.create_block(screen_name = '<some person I don't like>')
I get an exception
401 Unauthorized
(and that user is not blocked). I have been googling but only found old posts referring to my Windows time being not in sync. I synced the time and no improvement. I also tried blocking by ID but no luck.
Can anybody help ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

晨光如昨 2025-01-28 05:41:59

确保您的应用具有写入权限。

授予写入许可后,请确保再生并使用新的凭据来利用它。

https://tweepy.readthedocs.io/en/en/v4.8.0/faq.html#why-am-mi----- and ermi-en-a-401-unauthorized-erauthorized-error-带有-403-forbidden-error-with-client

Make sure your app has the write permission.

After giving it the write permission, make sure to regenerate and use new credentials to utilize it.

https://tweepy.readthedocs.io/en/v4.8.0/faq.html#why-am-i-encountering-a-401-unauthorized-error-with-api-or-403-forbidden-error-with-client

过去的过去 2025-01-28 05:41:59

我正在使用OAuth 2.0,该2.0不允许单独读取或写入权限。我尝试了刷新的凭证,但仍然相同。
我确实启用了Oauth 1.0A并再次再生凭证(再次),现在我可以阻止用户,谢谢!

I am using OAuth 2.0 which does not allow separate read or write permissions. I tried with refreshed credentials but still the same.
I did enable OAuth 1.0a and regenerated credentials (again) and now I can block users, Thanks !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文