Commit bda2cf3c authored by Joshua Roesslein's avatar Joshua Roesslein
Browse files

Merge pull request #218 from inactivist/streaming-fixes

Add stall_warnings parameter support to streaming endpoint
parents ef1e42c6 07f13c29
...@@ -135,9 +135,8 @@ class Stream(object): ...@@ -135,9 +135,8 @@ class Stream(object):
raise raise
def _data(self, data): def _data(self, data):
for d in [dt for dt in data.split('\n') if dt]: if self.listener.on_data(data) is False:
if self.listener.on_data(d) is False: self.running = False
self.running = False
def _read_loop(self, resp): def _read_loop(self, resp):
...@@ -208,7 +207,8 @@ class Stream(object): ...@@ -208,7 +207,8 @@ class Stream(object):
self.url += '&count=%s' % count self.url += '&count=%s' % count
self._start(async) self._start(async)
def filter(self, follow=None, track=None, async=False, locations=None, count = None): def filter(self, follow=None, track=None, async=False, locations=None,
count = None, stall_warnings=False):
self.parameters = {} self.parameters = {}
self.headers['Content-type'] = "application/x-www-form-urlencoded" self.headers['Content-type'] = "application/x-www-form-urlencoded"
if self.running: if self.running:
...@@ -223,6 +223,8 @@ class Stream(object): ...@@ -223,6 +223,8 @@ class Stream(object):
self.parameters['locations'] = ','.join(['%.2f' % l for l in locations]) self.parameters['locations'] = ','.join(['%.2f' % l for l in locations])
if count: if count:
self.parameters['count'] = count self.parameters['count'] = count
if stall_warnings:
self.parameters['stall_warnings'] = stall_warnings
self.body = urlencode_noplus(self.parameters) self.body = urlencode_noplus(self.parameters)
self.parameters['delimited'] = 'length' self.parameters['delimited'] = 'length'
self._start(async) self._start(async)
......
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