<s> from __future__ import absolute_import , unicode_literals <EOL> """<STR_LIT>""" <EOL> from oauthlib . common import Request , log <EOL> from . base import BaseEndpoint , catch_errors_and_unavailability <EOL> class TokenEndpoint ( BaseEndpoint ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , default_grant_type , default_token_type , grant_types ) : <EOL> BaseEndpoint . __init__ ( self ) <EOL> self . _grant_types = grant_types <EOL> self . _default_token_type = default_token_type <EOL> self . _default_grant_type = default_grant_type <EOL> @ property <EOL> def grant_types ( self ) : <EOL> return self . _grant_types <EOL> @ property <EOL> def default_grant_type ( self ) : <EOL> return self . _default_grant_type <EOL> @ property <EOL> def default_grant_type_handler ( self ) : <EOL> return self . grant_types . get ( self . default_grant_type ) <EOL> @ property <EOL> def default_token_type ( self ) : <EOL> return self . _default_token_type <EOL> @ catch_errors_and_unavailability <EOL> def create_token_response ( self , uri , http_method = '<STR_LIT:GET>' , body = None , <EOL> headers = None , credentials = None ) : <EOL> """<STR_LIT>""" <EOL> request = Request ( uri , http_method = http_method , body = body , headers = headers ) <EOL> request . scopes = None <EOL> request . extra_credentials = credentials <EOL> grant_type_handler = self . grant_types . get ( request . grant_type , <EOL> self . default_grant_type_handler ) <EOL> log . debug ( '<STR_LIT>' , <EOL> request . grant_type , grant_type_handler ) <EOL> return grant_type_handler . create_token_response ( <EOL> request , self . default_token_type ) </s>
