Skip to content

Instantly share code, notes, and snippets.

@bulkan
Created March 19, 2014 22:33
Show Gist options
  • Save bulkan/9652868 to your computer and use it in GitHub Desktop.
Save bulkan/9652868 to your computer and use it in GitHub Desktop.
from twython import TwythonStreamer
class TweetStreamer(TwythonStreamer):
tweets = []
def on_success(self, data):
if 'text' in data:
tweet = data['text'].encode('utf-8')
tweets.append(tweet)
print tweet
def on_error(self, status_code, data):
print status_code
self.disconnect()
if __name__ == '__main__':
# replace these with the details from your Twitter Application
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
streamer = TweetStreamer(consumer_key, consumer_secret,
access_token, access_token_secret)
streamer.statuses.filter(track = 'python')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment