Changed OAuth 2.0 to only refresh an access_token upon seeing a 401, ignoring token_expiry for now.

This commit is contained in:
Joe Gregorio
2011-02-09 23:27:46 -05:00
parent 02f1b63f65
commit 4b2e51aee5

View File

@@ -202,9 +202,6 @@ class OAuth2Credentials(Credentials):
Authorization header."""
if headers == None:
headers = {}
if ((self.token_expiry is not None) and (self.token_expiry <= datetime.datetime.now())):
logging.info("Refreshing because %s <= %s" %(self.token_expiry, datetime.datetime.now()))
self._refresh(request_orig)
headers['authorization'] = 'OAuth ' + self.access_token
if 'user-agent' in headers:
headers['user-agent'] = self.user_agent + ' ' + headers['user-agent']