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


Python SRegResponse.fromSuccessResponse方法代码示例

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


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

示例1: get_value_from_response

# 需要导入模块: from openid.extensions.sreg import SRegResponse [as 别名]
# 或者: from openid.extensions.sreg.SRegResponse import fromSuccessResponse [as 别名]
def get_value_from_response(response, sreg_names=None, ax_names=None):
    value = None
    if sreg_names:
        sreg = SRegResponse.fromSuccessResponse(response)
        if sreg:
            for name in sreg_names:
                value = sreg.get(name)
                if value:
                    break

    if not value and ax_names:
        ax = FetchResponse.fromSuccessResponse(response)
        if ax:
            for name in ax_names:
                try:
                    values = ax.get(name)
                    if values:
                        value = values[0]
                except KeyError:
                    pass
                if value:
                    break
    return value 
开发者ID:rtindru,项目名称:django-twilio-tfa,代码行数:25,代码来源:utils.py

示例2: sreg

# 需要导入模块: from openid.extensions.sreg import SRegResponse [as 别名]
# 或者: from openid.extensions.sreg.SRegResponse import fromSuccessResponse [as 别名]
def sreg(self):
        """
        Try to get OpenID Simple Registation
        http://openid.net/specs/openid-simple-registration-extension-1_0.html
        """
        if self.resp:
            resp = self.resp
            sreg_resp = SRegResponse.fromSuccessResponse(resp)
            return sreg_resp.data if sreg_resp else None
        else:
            return None 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:13,代码来源:openid_auth.py

示例3: __init__

# 需要导入模块: from openid.extensions.sreg import SRegResponse [as 别名]
# 或者: from openid.extensions.sreg.SRegResponse import fromSuccessResponse [as 别名]
def __init__(self, resp, extensions):
        sreg_resp = SRegResponse.fromSuccessResponse(resp)
        self.sreg = sreg_resp and sreg_resp.data or {}
        self.ax_resp = ax.FetchResponse.fromSuccessResponse(resp) or {}

        # Process the OpenID response with the OpenIDResponse class provided
        self.ext = {}
        for extension in extensions:
            ext_name = getattr(extension, 'ns_alias', extension.__name__)
            self.ext[ext_name] = \
                extension.fromSuccessResponse(resp) 
开发者ID:sunqb,项目名称:oa_qian,代码行数:13,代码来源:flask_openid.py

示例4: get_email_from_response

# 需要导入模块: from openid.extensions.sreg import SRegResponse [as 别名]
# 或者: from openid.extensions.sreg.SRegResponse import fromSuccessResponse [as 别名]
def get_email_from_response(response):
    email = None
    sreg = SRegResponse.fromSuccessResponse(response)
    if sreg:
        email = valid_email_or_none(sreg.get(SRegField.EMAIL))
    if not email:
        ax = FetchResponse.fromSuccessResponse(response)
        if ax:
            try:
                values = ax.get(AXAttribute.CONTACT_EMAIL)
                if values:
                    email = valid_email_or_none(values[0])
            except KeyError:
                pass
    return email 
开发者ID:rtindru,项目名称:django-twilio-tfa,代码行数:17,代码来源:utils.py


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