本文整理汇总了Python中oauthlib.common.Request.token_type方法的典型用法代码示例。如果您正苦于以下问题:Python Request.token_type方法的具体用法?Python Request.token_type怎么用?Python Request.token_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oauthlib.common.Request
的用法示例。
在下文中一共展示了Request.token_type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verify_request
# 需要导入模块: from oauthlib.common import Request [as 别名]
# 或者: from oauthlib.common.Request import token_type [as 别名]
def verify_request(self, uri, http_method='GET', body=None, headers=None):
"""Validate client, code etc, return body + headers"""
request = Request(uri, http_method, body, headers)
request.token_type = self.find_token_type(request)
token_type_handler = self.tokens.get(request.token_type,
self.default_token_type_handler)
return token_type_handler.validate_request(request)
示例2: verify_request
# 需要导入模块: from oauthlib.common import Request [as 别名]
# 或者: from oauthlib.common.Request import token_type [as 别名]
def verify_request(self, uri, http_method='GET', body=None, headers=None,
scopes=None):
"""Validate client, code etc, return body + headers"""
request = Request(uri, http_method, body, headers)
request.token_type = self.find_token_type(request)
request.scopes = scopes
token_type_handler = self.tokens.get(request.token_type,
self.default_token_type_handler)
log.debug('Dispatching token_type %s request to %r.',
request.token_type, token_type_handler)
return token_type_handler.validate_request(request), request
示例3: verify_request
# 需要导入模块: from oauthlib.common import Request [as 别名]
# 或者: from oauthlib.common.Request import token_type [as 别名]
def verify_request(self, uri, http_method='GET', body=None, headers=None):
"""Validate client, code etc, return body + headers"""
request = Request(uri, http_method, body, headers)
request.token_type = self.find_token_type(request)
# TODO(ib-lundgren): How to return errors is not strictly defined and
# should allow for customization.
if not request.token_type:
raise ValueError('Could not determine the token type.')
if not request.token_type in self.tokens:
raise ValueError('Unsupported token type.')
return self.tokens.get(request.token_type).validate_request(request)