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

Allow all listener methods to terminate stream by returning false.

parent dcbd075e
......@@ -119,12 +119,15 @@ class Stream(object):
# turn json data into status object
if 'in_reply_to_status_id' in data:
status = parse_status(data, self.api)
self.listener.on_status(status)
if self.listener.on_status(status) == False:
self.running = False
elif 'delete' in data:
delete = json.loads(data)['delete']['status']
self.listener.on_delete(delete['id'], delete['user_id'])
if self.listener.on_delete(delete['id'], delete['user_id']) == False:
self.running = False
elif 'limit' in data:
self.listener.on_limit(json.loads(data)['limit']['track'])
if self.listener.on_limit(json.loads(data)['limit']['track']) == False:
self.running = False
def firehose(self, count=None, ):
if self.running:
......
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