From 5a155d4b7c86905afadb7fc370cc9d17f9cf4fd9 Mon Sep 17 00:00:00 2001 From: Edward Hades Date: Sun, 4 Sep 2011 22:59:29 +0800 Subject: [PATCH] Fix AttributeError in OAuth version detection. Old versions of OAuth didn't have _version attribute, so Twython crashes on them with AttributeError. This version first checks if there is _version attribute. If no, obviously it's an old version. --- twython/twython.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twython/twython.py b/twython/twython.py index fad12b7..16bddf0 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -52,7 +52,7 @@ except ImportError: # url as part of the request object; older versions we need to patch for Python 2.5... ugh. ;P OAUTH_CALLBACK_IN_URL = False OAUTH_LIB_SUPPORTS_CALLBACK = False -if float(oauth._version.manual_verstr) <= 1.4: +if not hasattr(oauth, '_version') or float(oauth._version.manual_verstr) <= 1.4: OAUTH_CLIENT_INSPECTION = inspect.getargspec(oauth.Client.request) try: OAUTH_LIB_SUPPORTS_CALLBACK = 'callback_url' in OAUTH_CLIENT_INSPECTION.args