# Path: twitter-winner/oauthlib/oauth2/rfc6749/endpoints/base.py
# class BaseEndpoint(object):
#     def __init__(self):
#         self._available = True
#         self._catch_errors = False
# 
#     @property
#     def available(self):
#         return self._available
# 
#     @available.setter
#     def available(self, available):
#         self._available = available
# 
#     @property
#     def catch_errors(self):
#         return self._catch_errors
# 
#     @catch_errors.setter
#     def catch_errors(self, catch_errors):
#         self._catch_errors = catch_errors
# 
# def catch_errors_and_unavailability(f):
#     @functools.wraps(f)
#     def wrapper(endpoint, uri, *args, **kwargs):
#         if not endpoint.available:
#             e = TemporarilyUnavailableError()
#             log.info('Endpoint unavailable, ignoring request %s.' % uri)
#             return {}, e.json, 503
# 
#         if endpoint.catch_errors:
#             try:
#                 return f(endpoint, uri, *args, **kwargs)
#             except OAuth2Error:
#                 raise
#             except FatalClientError:
#                 raise
#             except Exception as e:
#                 error = ServerError()
#                 log.warning('Exception caught while processing request, %s.' % e)
#                 return {}, error.json, 500
#         else:
#             return f(endpoint, uri, *args, **kwargs)
#     return wrapper


from oauthlib.common import Request, log
from .base import BaseEndpoint, catch_errors_and_unavailability
        # For most cases, returning a 403 should suffice.

    The method in which the client utilizes the access token to
    authenticate with the resource server depends on the type of access
    token issued by the authorization server.  Typically, it involves
    using the HTTP "Authorization" request header field [RFC2617] with an
    authentication scheme defined by the specification of the access
    token type used, such as [RFC6750]::

        # Access tokens may also be provided in query and body
        https://example.com/protected?access_token=kjfch2345sdf   # Query
        access_token=sdf23409df   # Body
    """
    def __init__(self, default_token, token_types):
        BaseEndpoint.__init__(self)
        self._tokens = token_types
        self._default_token = default_token

    @property
    def default_token(self):
        return self._default_token

    @property
    def default_token_type_handler(self):
        return self.tokens.get(self.default_token)

    @property
    def tokens(self):
        return self._tokens


# Path: twitter-winner/oauthlib/oauth2/rfc6749/endpoints/base.py
# class BaseEndpoint(object):
#     def __init__(self):
#         self._available = True
#         self._catch_errors = False
# 
#     @property
#     def available(self):
#         return self._available
# 
#     @available.setter
#     def available(self, available):
#         self._available = available
# 
#     @property
#     def catch_errors(self):
#         return self._catch_errors
# 
#     @catch_errors.setter
#     def catch_errors(self, catch_errors):
#         self._catch_errors = catch_errors
# 
# def catch_errors_and_unavailability(f):
#     @functools.wraps(f)
#     def wrapper(endpoint, uri, *args, **kwargs):
#         if not endpoint.available:
#             e = TemporarilyUnavailableError()
#             log.info('Endpoint unavailable, ignoring request %s.' % uri)
#             return {}, e.json, 503
# 
#         if endpoint.catch_errors:
#             try:
#                 return f(endpoint, uri, *args, **kwargs)
#             except OAuth2Error:
#                 raise
#             except FatalClientError:
#                 raise
#             except Exception as e:
#                 error = ServerError()
#                 log.warning('Exception caught while processing request, %s.' % e)
#                 return {}, error.json, 500
#         else:
#             return f(endpoint, uri, *args, **kwargs)
#     return wrapper


# Path: twitter-winner/oauthlib/oauth2/rfc6749/endpoints/resource.py
from oauthlib.common import Request, log
from .base import BaseEndpoint, catch_errors_and_unavailability

        # For most cases, returning a 403 should suffice.

    The method in which the client utilizes the access token to
    authenticate with the resource server depends on the type of access
    token issued by the authorization server.  Typically, it involves
    using the HTTP "Authorization" request header field [RFC2617] with an
    authentication scheme defined by the specification of the access
    token type used, such as [RFC6750]::

        # Access tokens may also be provided in query and body
        https://example.com/protected?access_token=kjfch2345sdf   # Query
        access_token=sdf23409df   # Body
    """
    def __init__(self, default_token, token_types):
        BaseEndpoint.__init__(self)
        self._tokens = token_types
        self._default_token = default_token

    @property
    def default_token(self):
        return self._default_token

    @property
    def default_token_type_handler(self):
        return self.tokens.get(self.default_token)

    @property
    def tokens(self):
        return self._tokens


    @catch_errors_and_unavailability