Skip to content

Instantly share code, notes, and snippets.

@juliocc
Created August 8, 2013 16:25
Show Gist options
  • Save juliocc/6186170 to your computer and use it in GitHub Desktop.
Save juliocc/6186170 to your computer and use it in GitHub Desktop.
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