From df6f9a5b2ab85c62675265bbb00c1929cfdf9e29 Mon Sep 17 00:00:00 2001 From: Jordan Bouvier Date: Tue, 13 Mar 2012 16:36:27 -0500 Subject: [PATCH] Fix oauth_callback hack for when the oath lib doesn't support callback_url natively --- twython/twython.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/twython/twython.py b/twython/twython.py index 6d38ac3..e3c947a 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -215,10 +215,15 @@ class Twython(object): callback_url = self.callback_url or 'oob' request_args = {} + method = 'GET' if OAUTH_LIB_SUPPORTS_CALLBACK: request_args['callback_url'] = callback_url + else: + # This is a hack for versions of oauth that don't support the callback url + request_args['body'] = urllib.urlencode({'oauth_callback': callback_url}) + method = 'POST' - resp, content = self.client.request(self.request_token_url, "GET", **request_args) + resp, content = self.client.request(self.request_token_url, method, **request_args) if resp['status'] != '200': raise TwythonAuthError("Seems something couldn't be verified with your OAuth junk. Error: %s, Message: %s" % (resp['status'], content))