From f77d9eb523068132479c3dbd9a9e38a84d68af56 Mon Sep 17 00:00:00 2001 From: Mike Helmick Date: Thu, 27 Jun 2013 22:47:07 -0400 Subject: [PATCH] If bad tokens for oauth 2 obtain token, 'access_token' is never in the dict --- twython/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twython/api.py b/twython/api.py index b1706f2..a56b9eb 100644 --- a/twython/api.py +++ b/twython/api.py @@ -324,7 +324,7 @@ class Twython(EndpointsMixin, object): except AttributeError: content = json.loads(content) access_token = content['access_token'] - except (ValueError, requests.exceptions.RequestException): + except (KeyError, ValueError, requests.exceptions.RequestException): raise TwythonAuthError('Unable to obtain OAuth 2 access token.') else: return access_token