Created
August 8, 2013 16:25
-
-
Save juliocc/6186170 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 sys | |
import tweepy | |
consumer_key="" | |
consumer_secret="" | |
access_key = "" | |
access_secret = "" | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_key, access_secret) | |
api = tweepy.API(auth) | |
class CustomStreamListener(tweepy.StreamListener): | |
def on_status(self, status): | |
print status.text | |
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 | |
sapi = tweepy.streaming.Stream(auth, CustomStreamListener()) | |
sapi.filter(track=['curiosity']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment