diff options
Diffstat (limited to 'oauthlib/oauth2/rfc6749/utils.py')
-rw-r--r-- | oauthlib/oauth2/rfc6749/utils.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/oauthlib/oauth2/rfc6749/utils.py b/oauthlib/oauth2/rfc6749/utils.py index f67019d..7516c9e 100644 --- a/oauthlib/oauth2/rfc6749/utils.py +++ b/oauthlib/oauth2/rfc6749/utils.py @@ -10,7 +10,7 @@ from __future__ import absolute_import, unicode_literals import datetime import os -from oauthlib.common import unicode_type, urldecode +from oauthlib.common import urldecode try: from urllib import quote @@ -24,10 +24,10 @@ except ImportError: def list_to_scope(scope): """Convert a list of scopes to a space separated string.""" - if isinstance(scope, unicode_type) or scope is None: + if isinstance(scope, str) or scope is None: return scope elif isinstance(scope, (set, tuple, list)): - return " ".join([unicode_type(s) for s in scope]) + return " ".join([str(s) for s in scope]) else: raise ValueError("Invalid scope (%s), must be string, tuple, set, or list." % scope) @@ -35,7 +35,7 @@ def list_to_scope(scope): def scope_to_list(scope): """Convert a space separated string to a list of scopes.""" if isinstance(scope, (tuple, list, set)): - return [unicode_type(s) for s in scope] + return [str(s) for s in scope] elif scope is None: return None else: @@ -74,7 +74,7 @@ def escape(u): TODO: verify whether this can in fact be used for OAuth 2 """ - if not isinstance(u, unicode_type): + if not isinstance(u, str): raise ValueError('Only unicode objects are escapable.') return quote(u.encode('utf-8'), safe=b'~') @@ -84,7 +84,7 @@ def generate_age(issue_time): td = datetime.datetime.now() - issue_time age = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6) / 10 ** 6 - return unicode_type(age) + return str(age) def is_secure_transport(uri): |