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


Python Consumer.redirectURL方法代码示例

本文整理汇总了Python中openid.consumer.consumer.Consumer.redirectURL方法的典型用法代码示例。如果您正苦于以下问题:Python Consumer.redirectURL方法的具体用法?Python Consumer.redirectURL怎么用?Python Consumer.redirectURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openid.consumer.consumer.Consumer的用法示例。


在下文中一共展示了Consumer.redirectURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from openid.consumer.consumer import Consumer [as 别名]
# 或者: from openid.consumer.consumer.Consumer import redirectURL [as 别名]
    def get(self):
        federated_id = self.request.args.get(AUTH_REQUEST_FIELD)
        if not federated_id:
            response = Response("missing %s field\n" % AUTH_REQUEST_FIELD)
            # Since we only care about Ajax requests we don't have to do
            # anything more informative than a 409.
            response.status_code = 409
            return self.respond(response)

        session = self.environ.get(BEAKER_ENV_KEY)

        try:
            auth_request = Consumer(session, aeoid_store.AppEngineStore()).begin(federated_id)
        except DiscoveryFailure:
            response = Response("discovery failure\n")
            # Since we only care about Ajax requests we don't have to do
            # anything more informative than a 409.
            response.status_code = 409
            return self.respond(response)

        # If this raises a different exception it will be caught by the fwerks dispatcher.
        # TODO: We need a nicer way of handling exceptions here.

        host_url = self.request.host_url
        cont = self.request.args.get("continuation", "/")
        return_to = urlparse.urljoin(host_url, cont)

        redirect_url = auth_request.redirectURL(host_url, return_to)
        # The Ajax request wants the redirect url as plain text, not an actual
        # HTTP redirect.
        response = self.respond(Response(redirect_url))
        session.save()
        return response
开发者ID:thisgeek,项目名称:www.fireworksproject.com,代码行数:35,代码来源:base_handler.py


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