我正在遇到
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}')
我的应用程序似乎确实连接到一个项目(参见 img)
我发现一些链接表明这可能是与 API 身份验证相关的 Twitter 问题。但是,我想确认是否确实如此,以及是否有任何可能的解决方案或解决方法来解决此问题。
表明这可能是 Twitter 问题的链接:
https://github.com/twitterdev/Twitter-API-v2-sample-code/issues/58 https://github.com/twitterdev/Twitter-API-v2-sample-code/issues/58
https://twittercommunity.com/t/when-authentication-requests-to-the-twitter-api-v2-endpoints-you-must-use-keys-and-tokens-from-a-twitter-developer-app-附加到项目,您可以通过开发者门户创建项目/189699 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
我将非常感谢任何解决此问题的见解、解释或潜在解决方案。
您的应用程序有Free访问层仅允许:
- 使用 Twitter API v2 发布推文
- 使用 Twitter API v1.1 上传媒体并登录 Twitter
要做其他事情,你至少需要Basic访问层,这需要花费一些钱。
访问层记录在https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api
当然,您应该使用支持 V2 API 的最新版本的 Tweepy。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)