tweepy: StreamRule broken?
Hi,
I’m using streamrule to filter tweets for a given stream:
Here’s my code:
`class MyStream(tweepy.StreamingClient): # This function gets called when the stream is working def on_connect(self): print(“Connected”)
def on_tweet(self, tweet):
print(tweet.data)
return
stream = MyStream(bearer_token=bearer_token) stream.add_rules(tweepy.StreamRule(“#Bitcoin”)) #adding the rules stream.filter() #runs the stream`
And here’s the output:

None of it is relevant to the hashtag. Unsure what’s happening here. Any help?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 25 (11 by maintainers)
Thank you very much, now I understand what you mean. When I checked my filtering rules with the get_rules().data method, I found that there were some filtering rules in my previous code in StreamRule. After I deleted the rules one by one with delete_rules() and re-run my original code, I Get tweets with python characters. Thank you very much! !