Skip to content

Instantly share code, notes, and snippets.

@hdknr
Created October 27, 2009 04:46
Show Gist options
  • Save hdknr/219328 to your computer and use it in GitHub Desktop.
Save hdknr/219328 to your computer and use it in GitHub Desktop.
# from openid.extensions.ax import fromSuccessResponse
def fromSuccessResponse(cls, success_response, signed=True):
"""Construct a FetchResponse object from an OpenID library
SuccessResponse object.
@param success_response: A successful id_res response object
@type success_response: openid.consumer.consumer.SuccessResponse
@param signed: Whether non-signed args should be
processsed. If True (the default), only signed arguments
will be processsed.
@type signed: bool
@returns: A FetchResponse containing the data from the OpenID
message, or None if the SuccessResponse did not contain AX
extension data.
@raises AXError: when the AX data cannot be parsed.
"""
self = cls()
ax_args = success_response.extensionResponse(self.ns_uri, signed)
try:
self.parseExtensionArgs(ax_args)
except NotAXMessage, err:
return None
else:
return self
fromSuccessResponse = classmethod(fromSuccessResponse)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment