當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。