Fix sample to use Requests instead of httplib
authorjozef-mitro <jozef.mitro.sk@gmail.com>
Sun, 12 Oct 2014 13:31:28 +0000 (15:31 +0200)
committerjozef-mitro <jozef.mitro.sk@gmail.com>
Sun, 12 Oct 2014 13:31:28 +0000 (15:31 +0200)
tweepy/streaming.py

index d9ae8b30b9fcbe99ece1ae2c04b8cb8dd568a1d7..c29222002b5f5b5aa3d459c3af7b56f755f5bb6a 100644 (file)
@@ -307,13 +307,13 @@ class Stream(object):
         self.url = '/%s/statuses/retweet.json' % STREAM_VERSION
         self._start(async)
 
-    def sample(self, async=False, language=None):
+    def sample(self, async=False, languages=None):
+        self.session.params = {'delimited': 'length'}
         if self.running:
             raise TweepError('Stream object already connected!')
-        self.url = '/%s/statuses/sample.json?delimited=length' % STREAM_VERSION
-        if language:
-            self.url += '&language=%s' % language
-            self.parameters['language'] = language
+        self.url = '/%s/statuses/sample.json' % STREAM_VERSION
+        if languages:
+            self.session.params['language'] = ','.join(map(str, languages))
         self._start(async)
 
     def filter(self, follow=None, track=None, async=False, locations=None,