Token refresh to work with 'old' GData API
Contributed by crhyme.
Reviewed in http://codereview.appspot.com/6373049/.
diff --git a/oauth2client/client.py b/oauth2client/client.py
index e701f02..4e7ffcb 100644
--- a/oauth2client/client.py
+++ b/oauth2client/client.py
@@ -416,8 +416,9 @@
resp, content = request_orig(uri, method, body, headers,
redirections, connection_type)
- if resp.status == 401:
- logger.info('Refreshing due to a 401')
+ # Older API (GData) respond with 403
+ if resp.status in [401, 403]:
+ logger.info('Refreshing due to a %s' % str(resp.status))
self._refresh(request_orig)
self.apply(headers)
return request_orig(uri, method, body, headers,