本文整理汇总了Python中oauthlib.common.Request.redirect_uri方法的典型用法代码示例。如果您正苦于以下问题:Python Request.redirect_uri方法的具体用法?Python Request.redirect_uri怎么用?Python Request.redirect_uri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oauthlib.common.Request
的用法示例。
在下文中一共展示了Request.redirect_uri方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_request
# 需要导入模块: from oauthlib.common import Request [as 别名]
# 或者: from oauthlib.common.Request import redirect_uri [as 别名]
def _create_request(self, uri, http_method, body, headers):
# Only include body data from x-www-form-urlencoded requests
headers = headers or {}
if "Content-Type" in headers and CONTENT_TYPE_FORM_URLENCODED in headers["Content-Type"]:
request = Request(uri, http_method, body, headers)
else:
request = Request(uri, http_method, "", headers)
signature_type, params, oauth_params = self._get_signature_type_and_params(request)
# The server SHOULD return a 400 (Bad Request) status code when
# receiving a request with duplicated protocol parameters.
if len(dict(oauth_params)) != len(oauth_params):
raise errors.InvalidRequestError(description="Duplicate OAuth2 entries.")
oauth_params = dict(oauth_params)
request.signature = oauth_params.get("oauth_signature")
request.client_key = oauth_params.get("oauth_consumer_key")
request.resource_owner_key = oauth_params.get("oauth_token")
request.nonce = oauth_params.get("oauth_nonce")
request.timestamp = oauth_params.get("oauth_timestamp")
request.redirect_uri = oauth_params.get("oauth_callback")
request.verifier = oauth_params.get("oauth_verifier")
request.signature_method = oauth_params.get("oauth_signature_method")
request.realm = dict(params).get("realm")
request.oauth_params = oauth_params
# Parameters to Client depend on signature method which may vary
# for each request. Note that HMAC-SHA1 and PLAINTEXT share parameters
request.params = [(k, v) for k, v in params if k != "oauth_signature"]
if "realm" in request.headers.get("Authorization", ""):
request.params = [(k, v) for k, v in request.params if k != "realm"]
return request
示例2: make_request
# 需要导入模块: from oauthlib.common import Request [as 别名]
# 或者: from oauthlib.common.Request import redirect_uri [as 别名]
def make_request(self, response_type='code',
scope='openid profile email', **kwargs):
request = Request('https://a.b/path')
request.scope = scope
request.client = 'superman'
request.client_id = 'abcdef'
request.redirect_uri = 'https://a.b/'
request.response_type = response_type
for prop, val in kwargs.items():
setattr(request, prop, val)
return request