Apply the auth before connecting, otherwise it will fail on reconnection
authorRobin Houston <robin.houston@gmail.com>
Sat, 5 Mar 2011 16:15:19 +0000 (16:15 +0000)
committerRobin Houston <robin.houston@gmail.com>
Sat, 5 Mar 2011 16:15:19 +0000 (16:15 +0000)
when using OAuth (because the nonce has been used before, and the timestamp
is no longer correct).

tweepy/streaming.py

index b10444d71748fc7ab149c48d68d96e5ac8ed756c..73b632d95fdcfbffdc3c14e02a6776ad78791f9b 100644 (file)
@@ -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)