![](/img/trans.png)
[英]Tweepy StreamingClient (API v2) Error 429 - "This stream is currently at the maximum allowed connection limit."
[英]How to store data from StreamingClient.filter() or .sample() from the Tweepy Module Twitter API v2
我想存儲具有某些主題標簽的推文,例如#cats。 我可以通過執行client.search_recent_tweets(query="cats")
來提取 10 個最新的推文,但是當我從StreamingClient
類設置一個對象並嘗試使用.filter()
和.sample()
方法時,我好像查不到數據。。。
我正在使用 Juypter Notebook,我的代碼如下所示:
streaming_client = tweepy.StreamingClient(bearer_token=twitter_keys.bearer_token)
streaming_client.sample()
streaming_client.disconnect()
我不知道是否需要將流正在檢索的內容存儲在變量中或執行其他操作。 我一直在重新閱讀 Tweepy 4.9.0 文檔,但我在網上找不到任何似乎可以回答我的問題的東西,更不用說當我運行filter()
和sample()
方法時,我的內核仍在運行。 我只是困惑。
默認情況下,只有
StreamingClient.on_response()
在DEBUG
日志級別記錄接收到的數據。要自定義流數據的處理,
StreamingClient
需要被子類化。
https://tweepy.readthedocs.io/en/v4.9.0/streaming.html#using-streamingclient
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.