Created
March 19, 2014 22:33
-
-
Save bulkan/9652868 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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