Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew A. Russell committed Jan 28, 2011
1 parent f7c1197 commit 4784141
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions recipe__streaming_api.py
Expand Up @@ -9,15 +9,15 @@

# Get these values from your application settings

CONSUMER_KEY = ""
CONSUMER_SECRET = ""
CONSUMER_KEY = ''
CONSUMER_SECRET = ''

# Get these values from the "My Access Token" link located in the
# margin of your application details, or perform the full OAuth
# dance

ACCESS_TOKEN = ""
ACCESS_TOKEN_SECRET = ""
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
Expand All @@ -41,7 +41,10 @@ def on_status(self, status):
# store them elsewhere, retweet select statuses, etc.

try:
print "%s\t%s\t%s\t%s" % (status.text, status.author.screen_name, status.created_at, status.source,)
print "%s\t%s\t%s\t%s" % (status.text,
status.author.screen_name,
status.created_at,
status.source,)
except Exception, e:
print >> sys.stderr, 'Encountered Exception:', e
pass
Expand All @@ -54,7 +57,8 @@ def on_timeout(self):
print >> sys.stderr, 'Timeout...'
return True # Don't kill the stream

# Create a streaming API and set a timeout value of 1 minute
# Create a streaming API and set a timeout value of 60 seconds

streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout=60)

# Optionally filter the statuses you want to track by providing a list
Expand Down

0 comments on commit 4784141

Please sign in to comment.