Hi,, ‘do.json’), “a”, ‘utf-8’) as textFile: textFile.write(status.json) textFile.write(‘\n’)
def on_error(self, status_code): print >> sys.stderr, 'Encountered error with status code:', status_code return True # Don't kill the stream def on_timeout(self): print >> sys.stderr, 'Timeout...' return True # Don't kill the stream
if name == ‘main’: print “extracting” l = CustomStreamListener() auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret)
stream = tweepy.Stream(auth, l) stream.filter(track = keyword)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Have you checked if Twitter might be limiting your API queries?