0

I'm trying to reach out an event to recognize whenever specific user tweets , so im using stream.filter in tweepy , just like

class IDPrinter(tweepy.StreamingClient):

def on_tweet(self, tweet):
    print(tweet)
printer = IDPrinter("bearer")
printer.sample(expansions=['author_id'],user_fields=['1234']) #consider 1234 user_id to follow

but Stream encountered HTTP error: 400 ,what am i missing? im having api v2 and allowing OAuth v2 as well

SelvsterTP
  • 19
  • 3

1 Answers1

0

To be able to filter streaming data you need to give rules initially. So if you want to stream tweets of user with id 1234 you need give a rule for that, then when you start streaming, tweets that satisfy your rule will be retrieved.

For more information about adding rules on tweepy : StreamRule

For more about Twitter Api v2 Filtered Stream : How to build a rule

Shanazar
  • 54
  • 6