From 9f8c04b0f24a3a18781262e886be98655ae23700 Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Sat, 26 Feb 2011 01:56:28 -0500 Subject: [PATCH] Patch for Python 2.5; inspect.getargspec() doesn't return a named tuple pre-2.6, so catch on AttributeError and just check in the entire tuple. Increment to 1.4.1 and pushed to Pypi for the sake of 2.5 users. --- setup.py | 2 +- twython/twython.py | 9 +++++++-- twython3k/twython.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 8e3bf48..46f494e 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import setup from setuptools import find_packages __author__ = 'Ryan McGrath ' -__version__ = '1.4' +__version__ = '1.4.1' setup( # Basic package information. diff --git a/twython/twython.py b/twython/twython.py index a35e42b..7ce8973 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -9,7 +9,7 @@ """ __author__ = "Ryan McGrath " -__version__ = "1.4" +__version__ = "1.4.1" import urllib import urllib2 @@ -48,7 +48,12 @@ except ImportError: raise Exception("Twython requires the simplejson library (or Python 2.6) to work. http://www.undefined.org/python/") # Detect if oauth2 supports the callback_url argument to request -OAUTH_LIB_SUPPORTS_CALLBACK = 'callback_url' in inspect.getargspec(oauth.Client.request).args +OAUTH_CLIENT_INSPECTION = inspect.getargspec(oauth.Client.request) +try: + OAUTH_LIB_SUPPORTS_CALLBACK = 'callback_url' in OAUTH_CLIENT_INSPECTION.args +except AttributeError: + # Python 2.5 doesn't return named tuples, so don't look for an args section specifically. + OAUTH_LIB_SUPPORTS_CALLBACK = 'callback_url' in OAUTH_CLIENT_INSPECTION class TwythonError(AttributeError): """ diff --git a/twython3k/twython.py b/twython3k/twython.py index 7a86649..4c64a98 100644 --- a/twython3k/twython.py +++ b/twython3k/twython.py @@ -9,7 +9,7 @@ """ __author__ = "Ryan McGrath " -__version__ = "1.4" +__version__ = "1.4.1" import urllib.request, urllib.parse, urllib.error import urllib.request, urllib.error, urllib.parse