Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix multivalued param dict handling in to_url, fix oauth_body_hash sending for GET requests #95

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions oauth2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,11 @@ def to_url(self):
query = base_url[4]
query = parse_qs(query)
for k, v in self.items():
query.setdefault(k, []).append(v)
# deal with multivalued parameters properly
if hasattr(v, "__iter__"):
query.setdefault(k, []).extend(v)
else:
query.setdefault(k, []).append(v)

try:
scheme = base_url.scheme
Expand Down Expand Up @@ -484,7 +488,7 @@ def get_normalized_parameters(self):
def sign_request(self, signature_method, consumer, token):
"""Set the signature parameter to the result of sign."""

if not self.is_form_encoded:
if self.method not in ["GET", "HEAD"] and not self.is_form_encoded:
# according to
# http://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html
# section 4.1.1 "OAuth Consumers MUST NOT include an
Expand Down