proxies support
authorWen Wang <750636248@qq.com>
Tue, 24 Apr 2018 03:19:28 +0000 (11:19 +0800)
committerGitHub <noreply@github.com>
Tue, 24 Apr 2018 03:19:28 +0000 (11:19 +0800)
stream api supports proxies now

tweepy/streaming.py

index 43aa82340be425279e8c5339cb35173d8b089f2f..a64b271fc02f0b8b6e2f2736441d0c43d10a2d76 100644 (file)
@@ -220,6 +220,9 @@ class Stream(object):
         self.body = None
         self.retry_time = self.retry_time_start
         self.snooze_time = self.snooze_time_step
+        
+        # Example: proxies = {'http': 'http://localhost:1080', 'https': 'http://localhost:1080'}
+        self.proxies = options.get("proxies")
 
     def new_session(self):
         self.session = requests.Session()
@@ -247,7 +250,8 @@ class Stream(object):
                                             timeout=self.timeout,
                                             stream=True,
                                             auth=auth,
-                                            verify=self.verify)
+                                            verify=self.verify,
+                                            proxies = self.proxies)
                 if resp.status_code != 200:
                     if self.listener.on_error(resp.status_code) is False:
                         break