I am using Tweepy.StreamingClient to get some tweets but I am not able to get the username even if I add the filters. I am using the v.4.10.1 of Tweepy
JavaScript
x
19
19
1
from tweepy import StreamingClient
2
3
class TweetStreamerV2(StreamingClient):
4
5
def on_tweet(self, tweet):
6
# here I tried the following and nothing is returned
7
print(tweet.inlcudes)
8
print(tweet.user)
9
10
streamer = TweetStreamerV2(bearer_token)
11
12
# add new rules
13
rule = StreamRule(value="xxx")
14
streamer.add_rules(rule)
15
16
17
# add filters
18
streamer.filter(expansions="author_id", tweet_fields="created_at", user_fields="username")
19
Advertisement
Answer
Okay I figure it out!
I’m using on_tweet that only bring the class Tweet. Tweepy on_tweet
Instead I should use on_data that bring all info needed. Tweepy on_data