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

Merge pull request #701 from drevicko/stall-warnings-for-sample

Added stall_warnings parameter support to sample()
parents ba13fc5d bc3bbc19
...@@ -409,13 +409,15 @@ class Stream(object): ...@@ -409,13 +409,15 @@ class Stream(object):
self.url = '/%s/statuses/retweet.json' % STREAM_VERSION self.url = '/%s/statuses/retweet.json' % STREAM_VERSION
self._start(async) self._start(async)
def sample(self, async=False, languages=None): def sample(self, async=False, languages=None, stall_warnings=False):
self.session.params = {'delimited': 'length'} self.session.params = {'delimited': 'length'}
if self.running: if self.running:
raise TweepError('Stream object already connected!') raise TweepError('Stream object already connected!')
self.url = '/%s/statuses/sample.json' % STREAM_VERSION self.url = '/%s/statuses/sample.json' % STREAM_VERSION
if languages: if languages:
self.session.params['language'] = ','.join(map(str, languages)) self.session.params['language'] = ','.join(map(str, languages))
if stall_warnings:
self.session.params['stall_warnings'] = 'true'
self._start(async) self._start(async)
def filter(self, follow=None, track=None, async=False, locations=None, def filter(self, follow=None, track=None, async=False, locations=None,
......
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