Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed OAuth library callback_url detection code, as callback_url pa…

…ssing does not depend on that anymore.
  • Loading branch information...
commit e17b3ed87782d5ff2c5b197a3ffdf326da703172 1 parent 9153fdf
Erik authored
Showing with 2 additions and 22 deletions.
  1. +2 −22 twython/twython.py
View
24 twython/twython.py
@@ -49,21 +49,6 @@
# Seriously wtf is wrong with you if you get this Exception.
raise Exception("Twython requires the simplejson library (or Python 2.6) to work. http://www.undefined.org/python/")
-# Try and gauge the old OAuth2 library spec. Versions 1.5 and greater no longer have the callback
-# 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 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
- 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
-else:
- OAUTH_CALLBACK_IN_URL = True
-
-
class TwythonError(AttributeError):
"""
Generic error class, catch-all for most Twython issues.
@@ -256,17 +241,12 @@ def get_authentication_tokens(self):
oauth_callback_confirmed = request_tokens.get('oauth_callback_confirmed') == 'true'
- if not OAUTH_LIB_SUPPORTS_CALLBACK and callback_url != 'oob' and oauth_callback_confirmed:
- import warnings
- warnings.warn("oauth2 library doesn't support OAuth 1.0a type callback, but remote requires it")
- oauth_callback_confirmed = False
-
auth_url_params = {
'oauth_token': request_tokens['oauth_token'],
}
- # Use old-style callback argument
- if OAUTH_CALLBACK_IN_URL or (callback_url != 'oob' and not oauth_callback_confirmed):
+ # Use old-style callback argument if server didn't accept new-style
+ if callback_url != 'oob' and not oauth_callback_confirmed:
auth_url_params['oauth_callback'] = callback_url
request_tokens['auth_url'] = self.authenticate_url + '?' + urllib.urlencode(auth_url_params)
Please sign in to comment.
Something went wrong with that request. Please try again.