Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 82f8b8d

Browse files
jskitzAnthony Awtrey
authored andcommitted
Added a parameters keyword argument to the Client method request() so that the oauth_callback parameter can easily be added to the initial token request as required by OAuth 1.0a. This also let django-piston 0.3 work correctly with python-oauth2 sample clients.
1 parent c69428c commit 82f8b8d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

oauth2/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ def set_signature_method(self, method):
639639
self.method = method
640640

641641
def request(self, uri, method="GET", body='', headers=None,
642-
redirections=httplib2.DEFAULT_MAX_REDIRECTS, connection_type=None):
642+
redirections=httplib2.DEFAULT_MAX_REDIRECTS, connection_type=None, parameters={}):
643643
DEFAULT_POST_CONTENT_TYPE = 'application/x-www-form-urlencoded'
644644

645645
if not isinstance(headers, dict):
@@ -652,10 +652,9 @@ def request(self, uri, method="GET", body='', headers=None,
652652
is_form_encoded = \
653653
headers.get('Content-Type') == 'application/x-www-form-urlencoded'
654654

655+
parameters = parameters or {}
655656
if is_form_encoded and body:
656-
parameters = parse_qs(body)
657-
else:
658-
parameters = None
657+
parameters.update(parse_qs(body))
659658

660659
req = Request.from_consumer_and_token(self.consumer,
661660
token=self.token, http_method=method, http_url=uri,

0 commit comments

Comments
 (0)