From ce2964726fe3e4b1af43e2c3c3b687c339c67e6e Mon Sep 17 00:00:00 2001 From: Josh Roesslein Date: Sat, 9 Oct 2010 22:53:25 -0500 Subject: [PATCH] Allow for secure streams and make sure to properly apply auth for OAuth. --- tweepy/streaming.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index b22764c..661a3bb 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -69,7 +69,8 @@ class Stream(object): host = 'stream.twitter.com' def __init__(self, auth, listener, timeout=5.0, retry_count = None, - retry_time = 10.0, snooze_time = 5.0, buffer_size=1500, headers=None): + retry_time = 10.0, snooze_time = 5.0, buffer_size=1500, + headers=None, secure=False): self.auth = auth self.running = False self.timeout = timeout @@ -80,11 +81,16 @@ class Stream(object): self.listener = listener self.api = API() self.headers = headers or {} + if secure: + self.scheme = "https://" + else: + self.scheme = "http://" self.body = None def _run(self): # setup - self.auth.apply_auth(None, None, self.headers, None) + url = "%s%s%s" % (self.scheme, self.host, self.url) + self.auth.apply_auth(url, 'GET', self.headers, None) # enter loop error_counter = 0 -- 2.25.1