diff options
Diffstat (limited to 'oauthlib/oauth1/rfc5849/endpoints')
8 files changed, 4 insertions, 24 deletions
diff --git a/oauthlib/oauth1/rfc5849/endpoints/__init__.py b/oauthlib/oauth1/rfc5849/endpoints/__init__.py index b16ccba..78ade72 100644 --- a/oauthlib/oauth1/rfc5849/endpoints/__init__.py +++ b/oauthlib/oauth1/rfc5849/endpoints/__init__.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - from .base import BaseEndpoint from .request_token import RequestTokenEndpoint from .authorization import AuthorizationEndpoint diff --git a/oauthlib/oauth1/rfc5849/endpoints/access_token.py b/oauthlib/oauth1/rfc5849/endpoints/access_token.py index bea8274..13665db 100644 --- a/oauthlib/oauth1/rfc5849/endpoints/access_token.py +++ b/oauthlib/oauth1/rfc5849/endpoints/access_token.py @@ -8,8 +8,6 @@ OAuth 1.0 RFC 5849. It validates the correctness of access token requests, creates and persists tokens as well as create the proper response to be returned to the client. """ -from __future__ import absolute_import, unicode_literals - import logging from oauthlib.common import urlencode diff --git a/oauthlib/oauth1/rfc5849/endpoints/authorization.py b/oauthlib/oauth1/rfc5849/endpoints/authorization.py index b465946..7d0353b 100644 --- a/oauthlib/oauth1/rfc5849/endpoints/authorization.py +++ b/oauthlib/oauth1/rfc5849/endpoints/authorization.py @@ -6,17 +6,11 @@ oauthlib.oauth1.rfc5849.endpoints.authorization This module is an implementation of various logic needed for signing and checking OAuth 1.0 RFC 5849 requests. """ -from __future__ import absolute_import, unicode_literals - from oauthlib.common import Request, add_params_to_uri from .. import errors from .base import BaseEndpoint - -try: - from urllib import urlencode -except ImportError: - from urllib.parse import urlencode +from urllib.parse import urlencode class AuthorizationEndpoint(BaseEndpoint): diff --git a/oauthlib/oauth1/rfc5849/endpoints/base.py b/oauthlib/oauth1/rfc5849/endpoints/base.py index f005256..f9a8f57 100644 --- a/oauthlib/oauth1/rfc5849/endpoints/base.py +++ b/oauthlib/oauth1/rfc5849/endpoints/base.py @@ -6,8 +6,6 @@ oauthlib.oauth1.rfc5849.endpoints.base This module is an implementation of various logic needed for signing and checking OAuth 1.0 RFC 5849 requests. """ -from __future__ import absolute_import, unicode_literals - import time from oauthlib.common import CaseInsensitiveDict, Request, generate_token @@ -17,7 +15,7 @@ from .. import (CONTENT_TYPE_FORM_URLENCODED, SIGNATURE_HMAC_SHA1, SIGNATURE_HMA SIGNATURE_TYPE_QUERY, errors, signature, utils) -class BaseEndpoint(object): +class BaseEndpoint: def __init__(self, request_validator, token_generator=None): self.request_validator = request_validator @@ -131,7 +129,7 @@ class BaseEndpoint(object): if (not request.signature_method in self.request_validator.allowed_signature_methods): raise errors.InvalidSignatureMethodError( - description="Invalid signature, %s not in %r." % ( + description="Invalid signature, {} not in {!r}.".format( request.signature_method, self.request_validator.allowed_signature_methods)) diff --git a/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py b/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py index f89393a..b14a6d8 100644 --- a/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py +++ b/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - from . import (AccessTokenEndpoint, AuthorizationEndpoint, RequestTokenEndpoint, ResourceEndpoint) diff --git a/oauthlib/oauth1/rfc5849/endpoints/request_token.py b/oauthlib/oauth1/rfc5849/endpoints/request_token.py index e9ca331..bb67e71 100644 --- a/oauthlib/oauth1/rfc5849/endpoints/request_token.py +++ b/oauthlib/oauth1/rfc5849/endpoints/request_token.py @@ -8,8 +8,6 @@ OAuth 1.0 RFC 5849. It validates the correctness of request token requests, creates and persists tokens as well as create the proper response to be returned to the client. """ -from __future__ import absolute_import, unicode_literals - import logging from oauthlib.common import urlencode @@ -129,7 +127,7 @@ class RequestTokenEndpoint(BaseEndpoint): request.client_key, request) if not self.request_validator.check_realms(request.realms): raise errors.InvalidRequestError( - description='Invalid realm %s. Allowed are %r.' % ( + description='Invalid realm {}. Allowed are {!r}.'.format( request.realms, self.request_validator.realms)) if not request.redirect_uri: diff --git a/oauthlib/oauth1/rfc5849/endpoints/resource.py b/oauthlib/oauth1/rfc5849/endpoints/resource.py index f82e8b1..45bdaaa 100644 --- a/oauthlib/oauth1/rfc5849/endpoints/resource.py +++ b/oauthlib/oauth1/rfc5849/endpoints/resource.py @@ -6,8 +6,6 @@ oauthlib.oauth1.rfc5849.endpoints.resource This module is an implementation of the resource protection provider logic of OAuth 1.0 RFC 5849. """ -from __future__ import absolute_import, unicode_literals - import logging from .. import errors diff --git a/oauthlib/oauth1/rfc5849/endpoints/signature_only.py b/oauthlib/oauth1/rfc5849/endpoints/signature_only.py index 4297770..d693ccb 100644 --- a/oauthlib/oauth1/rfc5849/endpoints/signature_only.py +++ b/oauthlib/oauth1/rfc5849/endpoints/signature_only.py @@ -6,8 +6,6 @@ oauthlib.oauth1.rfc5849.endpoints.signature_only This module is an implementation of the signing logic of OAuth 1.0 RFC 5849. """ -from __future__ import absolute_import, unicode_literals - import logging from .. import errors |