Added stall_warnings parameter support to sample()
authordrevicko <subscriptions@drevicko.com>
Wed, 10 Feb 2016 17:42:00 +0000 (17:42 +0000)
committerdrevicko <subscriptions@drevicko.com>
Wed, 10 Feb 2016 17:42:00 +0000 (17:42 +0000)
Currently the stall_warnings parameter is unavailable for the sample endpoint.

tweepy/streaming.py

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