Last active
October 23, 2015 09:03
-
-
Save rudigiesler/3842f61e9bdb0cffb51f 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
import codecs | |
import locale | |
import sys | |
from twython import TwythonStreamer | |
TWITTER_APP_KEY = 'UGNwrWwBnxyBQSNC4qvWEr1rh' | |
TWITTER_APP_KEY_SECRET = 'lcanUrMAoSjFEu0zii8Pcp7z2J6ksmlhESKqhOwcvpkf7ypADq' | |
TWITTER_ACCESS_TOKEN = '2858511651-eOJXOAH6tnGh0TvfX1WbABK3QScUhtMNywWgzDg' | |
TWITTER_ACCESS_TOKEN_SECRET = 'jO0NUs8zeTv00Nq4qCF7YIJ08u2c3wboj3aofFS5FtRVj' | |
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout) | |
class HashtagStreamer(TwythonStreamer): | |
def on_success(self, data): | |
self.print_tweet(data) | |
def print_tweet(self, tweet): | |
print '%s [%s]:\n%s\n' % ( | |
tweet['user']['name'], tweet['created_at'], tweet['text']) | |
stream = HashtagStreamer( | |
TWITTER_APP_KEY, TWITTER_APP_KEY_SECRET, TWITTER_ACCESS_TOKEN, | |
TWITTER_ACCESS_TOKEN_SECRET) | |
stream.statuses.filter(track='feesmustfall') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment