try: with open('collect.json','a') as f: f.write(data) return True except BaseException as e: print("Error on_data: %s" % str(e)) time.sleep(5) return True
def on_error(self, status):
print(status) return True
twitter_stream = Stream(auth, MyListener())
twitter_stream.filter(track=['#budget2020']) #twitter_stream.filter(track=['#place the hashtags seperated by commas']) #twitter_stream.filter(track=['#a','#b']) in this way