当前位置: 首页>>代码示例>>Python>>正文


Python Request.redirect_uri方法代码示例

本文整理汇总了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
开发者ID:hitigon,项目名称:oauthlib,代码行数:37,代码来源:base.py

示例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
开发者ID:intelie,项目名称:python-openidconnect,代码行数:16,代码来源:utils.py


注:本文中的oauthlib.common.Request.redirect_uri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。