diff options
Diffstat (limited to 'oauthlib')
-rw-r--r-- | oauthlib/common.py | 8 | ||||
-rw-r--r-- | oauthlib/oauth1/rfc5849/signature.py | 2 | ||||
-rw-r--r-- | oauthlib/oauth1/rfc5849/utils.py | 2 | ||||
-rw-r--r-- | oauthlib/oauth2/draft25/utils.py | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/oauthlib/common.py b/oauthlib/common.py index 94a1650..1402e49 100644 --- a/oauthlib/common.py +++ b/oauthlib/common.py @@ -44,20 +44,22 @@ else: unicode_type = unicode bytes_type = str -def quote(s, safe='/'): + +# 'safe' must be bytes (Python 2.6 requires bytes, other versions allow either) +def quote(s, safe=b'/'): + s = _quote(s, safe) # PY3 always returns unicode. PY2 may return either, depending on whether # it had to modify the string. - s = _quote(s, safe) if isinstance(s, bytes_type): s = s.decode('utf-8') return s def unquote(s): + s = _unquote(s) # PY3 always returns unicode. PY2 seems to always return what you give it, # which differs from quote's behavior. Just to be safe, make sure it is # unicode before we return. - s = _unquote(s) if isinstance(s, bytes_type): s = s.decode('utf-8') return s diff --git a/oauthlib/oauth1/rfc5849/signature.py b/oauthlib/oauth1/rfc5849/signature.py index 860e61d..927b60b 100644 --- a/oauthlib/oauth1/rfc5849/signature.py +++ b/oauthlib/oauth1/rfc5849/signature.py @@ -170,7 +170,7 @@ def normalize_base_string_uri(uri): # # .. _`section 3.4.1.3`: http://tools.ietf.org/html/rfc5849#section-3.4.1.3 -def collect_parameters(uri_query=b'', body=[], headers=None, +def collect_parameters(uri_query='', body=[], headers=None, exclude_oauth_signature=True): """**Parameter Sources** diff --git a/oauthlib/oauth1/rfc5849/utils.py b/oauthlib/oauth1/rfc5849/utils.py index f4d1231..a5d7453 100644 --- a/oauthlib/oauth1/rfc5849/utils.py +++ b/oauthlib/oauth1/rfc5849/utils.py @@ -56,7 +56,7 @@ def escape(u): raise ValueError('Only unicode objects are escapable.') # Letters, digits, and the characters '_.-' are already treated as safe # by urllib.quote(). We need to add '~' to fully support rfc5849. - return quote(u, safe='~') + return quote(u, safe=b'~') def unescape(u): diff --git a/oauthlib/oauth2/draft25/utils.py b/oauthlib/oauth2/draft25/utils.py index cfeb07c..fdc4859 100644 --- a/oauthlib/oauth2/draft25/utils.py +++ b/oauthlib/oauth2/draft25/utils.py @@ -64,4 +64,4 @@ def escape(u): """ if not isinstance(u, unicode_type): raise ValueError('Only unicode objects are escapable.') - return quote(u.encode('utf-8'), safe='~') + return quote(u.encode('utf-8'), safe=b'~') |