Skip to content

Commit bda2cf3

Browse files
committed
Merge pull request tweepy#218 from inactivist/streaming-fixes
Add stall_warnings parameter support to streaming endpoint
2 parents ef1e42c + 07f13c2 commit bda2cf3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tweepy/streaming.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,8 @@ def _run(self):
135135
raise
136136

137137
def _data(self, data):
138-
for d in [dt for dt in data.split('\n') if dt]:
139-
if self.listener.on_data(d) is False:
140-
self.running = False
138+
if self.listener.on_data(data) is False:
139+
self.running = False
141140

142141
def _read_loop(self, resp):
143142

@@ -208,7 +207,8 @@ def sample(self, count=None, async=False):
208207
self.url += '&count=%s' % count
209208
self._start(async)
210209

211-
def filter(self, follow=None, track=None, async=False, locations=None, count = None):
210+
def filter(self, follow=None, track=None, async=False, locations=None,
211+
count = None, stall_warnings=False):
212212
self.parameters = {}
213213
self.headers['Content-type'] = "application/x-www-form-urlencoded"
214214
if self.running:
@@ -223,6 +223,8 @@ def filter(self, follow=None, track=None, async=False, locations=None, count = N
223223
self.parameters['locations'] = ','.join(['%.2f' % l for l in locations])
224224
if count:
225225
self.parameters['count'] = count
226+
if stall_warnings:
227+
self.parameters['stall_warnings'] = stall_warnings
226228
self.body = urlencode_noplus(self.parameters)
227229
self.parameters['delimited'] = 'length'
228230
self._start(async)

0 commit comments

Comments
 (0)