![](/img/trans.png)
[英]Receiving "Stream encountered HTTP error: 403" when using Twitter API. What is causing this error and how can I fix it?
[英]Twitter API: Stream encountered HTTP error: 403
我正在嘗試在 Python 中使用 Twitter API。 我獲得了提升的訪問權限,在 Developer Portal 中設置了我的應用程序,並通過了 OAuth 1.0 的身份驗證。
當我編寫代碼時,我總是收到以下錯誤:Stream 遇到 HTTP 錯誤:403。我做錯了什么?
import tweepy
api_key = ""
api_key_secret = ""
access_token = ""
access_token_secret = ""
stream = tweepy.Stream(api_key,api_key_secret, access_token, access_token_secret)
stream.filter(track=["President"])```
為此,您需要使用 Twitter API v2(Tweepy 支持它,但您需要更新代碼)。 不管提升的訪問權限如何,在 2022 年 4 月 29 日之后,新應用程序將無法再訪問 v1.1 流媒體。
新的 Twitter 開發者應用程序:
將無法訪問 v1.1 statuses/sample 和 v1.1 statuses/filter
也在這里回答。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.