summaryrefslogtreecommitdiff
path: root/oauthlib/common.py
diff options
context:
space:
mode:
authorIb Lundgren <ib.lundgren@gmail.com>2014-09-24 17:32:39 +0100
committerIb Lundgren <ib.lundgren@gmail.com>2014-09-24 17:32:39 +0100
commit2d7dab66b589159712f96bd0086f45ae3c32216d (patch)
tree1e24d34ada1982ef2865530ff18d228164c0d35a /oauthlib/common.py
parent39013947bd2e242dda85fb0f150c49be23fd7510 (diff)
downloadoauthlib-2d7dab66b589159712f96bd0086f45ae3c32216d.tar.gz
Auto pep8 changes throughout the code base.
Diffstat (limited to 'oauthlib/common.py')
-rw-r--r--oauthlib/common.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/oauthlib/common.py b/oauthlib/common.py
index d3e2edb..b200a9a 100644
--- a/oauthlib/common.py
+++ b/oauthlib/common.py
@@ -33,7 +33,7 @@ UNICODE_ASCII_CHARACTER_SET = ('abcdefghijklmnopqrstuvwxyz'
'0123456789')
CLIENT_ID_CHARACTER_SET = (r' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN'
- 'OPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}')
+ 'OPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}')
always_safe = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -147,7 +147,8 @@ def urldecode(query):
# Python 3.3 however
# >>> urllib.parse.parse_qsl(u'%E5%95%A6%E5%95%A6')
# u'\u5566\u5566'
- query = query.encode('utf-8') if not PY3 and isinstance(query, unicode_type) else query
+ query = query.encode(
+ 'utf-8') if not PY3 and isinstance(query, unicode_type) else query
# We want to allow queries such as "c2" whereas urlparse.parse_qsl
# with the strict_parsing flag will not.
params = urlparse.parse_qsl(query, keep_blank_values=True)
@@ -252,7 +253,7 @@ def verify_signed_token(private_pem, token):
public_key = RSA.importKey(private_pem).publickey()
try:
- #return jwt.verify_jwt(token.encode(), public_key)
+ # return jwt.verify_jwt(token.encode(), public_key)
return jwt.decode(token, public_key)
except:
raise Exception
@@ -330,6 +331,7 @@ def to_unicode(data, encoding='UTF-8'):
class CaseInsensitiveDict(dict):
+
"""Basic case insensitive dict with strings only keys."""
proxy = {}
@@ -360,6 +362,7 @@ class CaseInsensitiveDict(dict):
class Request(object):
+
"""A malleable representation of a signable HTTP request.
Body argument may contain any data, but parameters will only be decoded if
@@ -374,7 +377,7 @@ class Request(object):
"""
def __init__(self, uri, http_method='GET', body=None, headers=None,
- encoding='utf-8'):
+ encoding='utf-8'):
# Convert to unicode using encoding if given, else assume unicode
encode = lambda x: to_unicode(x, encoding) if encoding else x
@@ -393,10 +396,9 @@ class Request(object):
def __getattr__(self, name):
return self._params.get(name, None)
-
def __repr__(self):
return '<oauthlib.Request url="%s", http_method="%s", headers="%s", body="%s">' % (
- self.uri, self.http_method, self.headers, self.body)
+ self.uri, self.http_method, self.headers, self.body)
@property
def uri_query(self):
@@ -412,7 +414,8 @@ class Request(object):
@property
def duplicate_params(self):
seen_keys = collections.defaultdict(int)
- all_keys = (p[0] for p in (self.decoded_body or []) + self.uri_query_params)
+ all_keys = (p[0]
+ for p in (self.decoded_body or []) + self.uri_query_params)
for k in all_keys:
seen_keys[k] += 1
return [k for k, c in seen_keys.items() if c > 1]