tweepy.errors.Forbidden: 403 Forbidden - 使用Tweepy进行Twitter API身份验证时出现问题

3
我遇到了一个问题。
tweepy.errors.Forbidden: 403 Forbidden
When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.

尝试运行以下代码,使用Twitter API和Tweepy获取用户的帖子历史记录时:
    client = tweepy.Client(bearer_token=bearer_token)
    tweets = client.search_recent_tweets(query=f'from:{user_handle}')

我的应用似乎与一个项目连接在一起(见图) 我找到了一些链接,表明这可能是与API身份验证有关的Twitter问题。然而,我想确认一下是否确实如此,并且是否有任何可能的解决方案或解决此问题的方法。
表明可能是Twitter问题的链接:

https://github.com/twitterdev/Twitter-API-v2-sample-code/issues/58 https://twittercommunity.com/t/when-authenticating-requests-to-the-twitter-api-v2-endpoints-you-must-use-keys-and-tokens-from-a-twitter-developer-app-that-is-attached-to-a-project-you-can-create-a-project-via-the-developer-portal/189699

我非常感激任何关于解决这个问题的见解、解释或潜在解决方案。

enter image description here

1个回答

5
你的应用有一个免费的访问层级,只允许以下操作:
- 使用 Twitter API v2 发布推文 - 使用 Twitter API v1.1 进行媒体上传和登录
如果想要进行其他操作,至少需要购买基本的访问层级,需要支付一定费用。
关于访问层级的详细信息,请参考https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api
当然,你应该使用支持 V2 API 的最新版本的 Tweepy。

1
好的,我现在明白为什么我的代码不起作用了,说实话,对于那个平台来说真的是非常遗憾!谢谢埃隆。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接