I am just testing the API with python framework tweepy. Everything works except streaming I triple checked my tokens and keys and they are the same. My machine time is also right.
Here is my code:
class MyListener(tweepy.StreamListener): def on_data(self, data): with open("data.txt", 'w') as f: print(data) f.write(data) return True def on_error(self, status): print(status) return True auth = OAuthHandler(consumer_key=consumer_key, consumer_secret=consumer_secret, callback="http://127.0.0.1/") auth.set_access_token(access_token, access_secret) twitter_stream = tweepy.Stream(auth, MyListener()) twitter_stream.filter(track=['#python'])
The only thing I get is 401 which I know is unauthorized. I tried different ways of writing the code and etc but nothing works
P.S: I just saw that even tho my time is right for the time zone I am in but just posted tweets on my timeline are shown to be posted 1h ago can this be the cause? And how to fix?