Commit ecdc8b54 authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Added on_timeout() to stream listener.

parent cc3f9a4d
......@@ -14,6 +14,9 @@ class StreamWatcherListener(tweepy.StreamListener):
print 'An error has occured! Status code = %s' % status_code
return True # keep stream alive
def on_timeout(self):
print 'Snoozing Zzzzzz'
# Prompt for login credentials and setup stream object
username = raw_input('Twitter username: ')
password = getpass('Twitter password: ')
......@@ -37,6 +37,10 @@ class StreamListener(object):
"""Called when a non-200 status code is returned"""
return False
def on_timeout(self):
"""Called when stream connection times out"""
class Stream(object):
host = ''
......@@ -80,7 +84,8 @@ class Stream(object):
error_counter = 0
except timeout:
print 'timeout!'
if self.listener.on_timeout() == False:
if self.running is False:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment