From: Robin Houston Date: Sat, 5 Mar 2011 16:15:19 +0000 (+0000) Subject: Apply the auth before connecting, otherwise it will fail on reconnection X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6a1e170b371bfd52716ae05d85c2f303065fc687;p=tweepy.git Apply the auth before connecting, otherwise it will fail on reconnection when using OAuth (because the nonce has been used before, and the timestamp is no longer correct). --- diff --git a/tweepy/streaming.py b/tweepy/streaming.py index b10444d..73b632d 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -89,7 +89,6 @@ class Stream(object): def _run(self): # Authenticate url = "%s://%s%s" % (self.scheme, self.host, self.url) - self.auth.apply_auth(url, 'POST', self.headers, self.parameters) # Connect and process the stream error_counter = 0 @@ -104,6 +103,7 @@ class Stream(object): conn = httplib.HTTPConnection(self.host) else: conn = httplib.HTTPSConnection(self.host) + self.auth.apply_auth(url, 'POST', self.headers, self.parameters) conn.connect() conn.sock.settimeout(self.timeout) conn.request('POST', self.url, self.body, headers=self.headers)