repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
openid/python-openid | openid/yadis/manager.py | Discovery.getManager | def getManager(self, force=False):
"""Extract the YadisServiceManager for this object's URL and
suffix from the session.
@param force: True if the manager should be returned
regardless of whether it's a manager for self.url.
@return: The current YadisServiceManager, if it's for... | python | def getManager(self, force=False):
"""Extract the YadisServiceManager for this object's URL and
suffix from the session.
@param force: True if the manager should be returned
regardless of whether it's a manager for self.url.
@return: The current YadisServiceManager, if it's for... | [
"def",
"getManager",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"manager",
"=",
"self",
".",
"session",
".",
"get",
"(",
"self",
".",
"getSessionKey",
"(",
")",
")",
"if",
"(",
"manager",
"is",
"not",
"None",
"and",
"(",
"manager",
".",
"fo... | Extract the YadisServiceManager for this object's URL and
suffix from the session.
@param force: True if the manager should be returned
regardless of whether it's a manager for self.url.
@return: The current YadisServiceManager, if it's for this
URL, or else None | [
"Extract",
"the",
"YadisServiceManager",
"for",
"this",
"object",
"s",
"URL",
"and",
"suffix",
"from",
"the",
"session",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/manager.py#L146-L160 | train |
openid/python-openid | openid/yadis/manager.py | Discovery.createManager | def createManager(self, services, yadis_url=None):
"""Create a new YadisService Manager for this starting URL and
suffix, and store it in the session.
@raises KeyError: When I already have a manager.
@return: A new YadisServiceManager or None
"""
key = self.getSessionKe... | python | def createManager(self, services, yadis_url=None):
"""Create a new YadisService Manager for this starting URL and
suffix, and store it in the session.
@raises KeyError: When I already have a manager.
@return: A new YadisServiceManager or None
"""
key = self.getSessionKe... | [
"def",
"createManager",
"(",
"self",
",",
"services",
",",
"yadis_url",
"=",
"None",
")",
":",
"key",
"=",
"self",
".",
"getSessionKey",
"(",
")",
"if",
"self",
".",
"getManager",
"(",
")",
":",
"raise",
"KeyError",
"(",
"'There is already a %r manager for %... | Create a new YadisService Manager for this starting URL and
suffix, and store it in the session.
@raises KeyError: When I already have a manager.
@return: A new YadisServiceManager or None | [
"Create",
"a",
"new",
"YadisService",
"Manager",
"for",
"this",
"starting",
"URL",
"and",
"suffix",
"and",
"store",
"it",
"in",
"the",
"session",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/manager.py#L162-L180 | train |
openid/python-openid | openid/yadis/manager.py | Discovery.destroyManager | def destroyManager(self, force=False):
"""Delete any YadisServiceManager with this starting URL and
suffix from the session.
If there is no service manager or the service manager is for a
different URL, it silently does nothing.
@param force: True if the manager should be delet... | python | def destroyManager(self, force=False):
"""Delete any YadisServiceManager with this starting URL and
suffix from the session.
If there is no service manager or the service manager is for a
different URL, it silently does nothing.
@param force: True if the manager should be delet... | [
"def",
"destroyManager",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"self",
".",
"getManager",
"(",
"force",
"=",
"force",
")",
"is",
"not",
"None",
":",
"key",
"=",
"self",
".",
"getSessionKey",
"(",
")",
"del",
"self",
".",
"session",... | Delete any YadisServiceManager with this starting URL and
suffix from the session.
If there is no service manager or the service manager is for a
different URL, it silently does nothing.
@param force: True if the manager should be deleted regardless
of whether it's a manager fo... | [
"Delete",
"any",
"YadisServiceManager",
"with",
"this",
"starting",
"URL",
"and",
"suffix",
"from",
"the",
"session",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/manager.py#L182-L194 | train |
openid/python-openid | openid/dh.py | DiffieHellman._setPrivate | def _setPrivate(self, private):
"""This is here to make testing easier"""
self.private = private
self.public = pow(self.generator, self.private, self.modulus) | python | def _setPrivate(self, private):
"""This is here to make testing easier"""
self.private = private
self.public = pow(self.generator, self.private, self.modulus) | [
"def",
"_setPrivate",
"(",
"self",
",",
"private",
")",
":",
"self",
".",
"private",
"=",
"private",
"self",
".",
"public",
"=",
"pow",
"(",
"self",
".",
"generator",
",",
"self",
".",
"private",
",",
"self",
".",
"modulus",
")"
] | This is here to make testing easier | [
"This",
"is",
"here",
"to",
"make",
"testing",
"easier"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/dh.py#L27-L30 | train |
openid/python-openid | openid/server/server.py | AssociateRequest.answerUnsupported | def answerUnsupported(self, message, preferred_association_type=None,
preferred_session_type=None):
"""Respond to this request indicating that the association
type or association session type is not supported."""
if self.message.isOpenID1():
raise ProtocolEr... | python | def answerUnsupported(self, message, preferred_association_type=None,
preferred_session_type=None):
"""Respond to this request indicating that the association
type or association session type is not supported."""
if self.message.isOpenID1():
raise ProtocolEr... | [
"def",
"answerUnsupported",
"(",
"self",
",",
"message",
",",
"preferred_association_type",
"=",
"None",
",",
"preferred_session_type",
"=",
"None",
")",
":",
"if",
"self",
".",
"message",
".",
"isOpenID1",
"(",
")",
":",
"raise",
"ProtocolError",
"(",
"self",... | Respond to this request indicating that the association
type or association session type is not supported. | [
"Respond",
"to",
"this",
"request",
"indicating",
"that",
"the",
"association",
"type",
"or",
"association",
"session",
"type",
"is",
"not",
"supported",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L486-L505 | train |
openid/python-openid | openid/server/server.py | CheckIDRequest.fromMessage | def fromMessage(klass, message, op_endpoint):
"""Construct me from an OpenID message.
@raises ProtocolError: When not all required parameters are present
in the message.
@raises MalformedReturnURL: When the C{return_to} URL is not a URL.
@raises UntrustedReturnURL: When th... | python | def fromMessage(klass, message, op_endpoint):
"""Construct me from an OpenID message.
@raises ProtocolError: When not all required parameters are present
in the message.
@raises MalformedReturnURL: When the C{return_to} URL is not a URL.
@raises UntrustedReturnURL: When th... | [
"def",
"fromMessage",
"(",
"klass",
",",
"message",
",",
"op_endpoint",
")",
":",
"self",
"=",
"klass",
".",
"__new__",
"(",
"klass",
")",
"self",
".",
"message",
"=",
"message",
"self",
".",
"op_endpoint",
"=",
"op_endpoint",
"mode",
"=",
"message",
"."... | Construct me from an OpenID message.
@raises ProtocolError: When not all required parameters are present
in the message.
@raises MalformedReturnURL: When the C{return_to} URL is not a URL.
@raises UntrustedReturnURL: When the C{return_to} URL is outside
the C{trust_roo... | [
"Construct",
"me",
"from",
"an",
"OpenID",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L580-L672 | train |
openid/python-openid | openid/server/server.py | CheckIDRequest.trustRootValid | def trustRootValid(self):
"""Is my return_to under my trust_root?
@returntype: bool
"""
if not self.trust_root:
return True
tr = TrustRoot.parse(self.trust_root)
if tr is None:
raise MalformedTrustRoot(self.message, self.trust_root)
if se... | python | def trustRootValid(self):
"""Is my return_to under my trust_root?
@returntype: bool
"""
if not self.trust_root:
return True
tr = TrustRoot.parse(self.trust_root)
if tr is None:
raise MalformedTrustRoot(self.message, self.trust_root)
if se... | [
"def",
"trustRootValid",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"trust_root",
":",
"return",
"True",
"tr",
"=",
"TrustRoot",
".",
"parse",
"(",
"self",
".",
"trust_root",
")",
"if",
"tr",
"is",
"None",
":",
"raise",
"MalformedTrustRoot",
"(",
... | Is my return_to under my trust_root?
@returntype: bool | [
"Is",
"my",
"return_to",
"under",
"my",
"trust_root?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L684-L698 | train |
openid/python-openid | openid/server/server.py | CheckIDRequest.encodeToURL | def encodeToURL(self, server_url):
"""Encode this request as a URL to GET.
@param server_url: The URL of the OpenID server to make this request of.
@type server_url: str
@returntype: str
@raises NoReturnError: when I do not have a return_to.
"""
if not self.ret... | python | def encodeToURL(self, server_url):
"""Encode this request as a URL to GET.
@param server_url: The URL of the OpenID server to make this request of.
@type server_url: str
@returntype: str
@raises NoReturnError: when I do not have a return_to.
"""
if not self.ret... | [
"def",
"encodeToURL",
"(",
"self",
",",
"server_url",
")",
":",
"if",
"not",
"self",
".",
"return_to",
":",
"raise",
"NoReturnToError",
"q",
"=",
"{",
"'mode'",
":",
"self",
".",
"mode",
",",
"'identity'",
":",
"self",
".",
"identity",
",",
"'claimed_id'... | Encode this request as a URL to GET.
@param server_url: The URL of the OpenID server to make this request of.
@type server_url: str
@returntype: str
@raises NoReturnError: when I do not have a return_to. | [
"Encode",
"this",
"request",
"as",
"a",
"URL",
"to",
"GET",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L883-L914 | train |
openid/python-openid | openid/server/server.py | CheckIDRequest.getCancelURL | def getCancelURL(self):
"""Get the URL to cancel this request.
Useful for creating a "Cancel" button on a web form so that operation
can be carried out directly without another trip through the server.
(Except you probably want to make another trip through the server so
that it... | python | def getCancelURL(self):
"""Get the URL to cancel this request.
Useful for creating a "Cancel" button on a web form so that operation
can be carried out directly without another trip through the server.
(Except you probably want to make another trip through the server so
that it... | [
"def",
"getCancelURL",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"return_to",
":",
"raise",
"NoReturnToError",
"if",
"self",
".",
"immediate",
":",
"raise",
"ValueError",
"(",
"\"Cancel is not an appropriate response to \"",
"\"immediate mode requests.\"",
")",... | Get the URL to cancel this request.
Useful for creating a "Cancel" button on a web form so that operation
can be carried out directly without another trip through the server.
(Except you probably want to make another trip through the server so
that it knows that the user did make a dec... | [
"Get",
"the",
"URL",
"to",
"cancel",
"this",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L917-L941 | train |
openid/python-openid | openid/server/server.py | OpenIDResponse.toFormMarkup | def toFormMarkup(self, form_tag_attrs=None):
"""Returns the form markup for this response.
@param form_tag_attrs: Dictionary of attributes to be added to
the form tag. 'accept-charset' and 'enctype' have defaults
that can be overridden. If a value is supplied for
'ac... | python | def toFormMarkup(self, form_tag_attrs=None):
"""Returns the form markup for this response.
@param form_tag_attrs: Dictionary of attributes to be added to
the form tag. 'accept-charset' and 'enctype' have defaults
that can be overridden. If a value is supplied for
'ac... | [
"def",
"toFormMarkup",
"(",
"self",
",",
"form_tag_attrs",
"=",
"None",
")",
":",
"return",
"self",
".",
"fields",
".",
"toFormMarkup",
"(",
"self",
".",
"request",
".",
"return_to",
",",
"form_tag_attrs",
"=",
"form_tag_attrs",
")"
] | Returns the form markup for this response.
@param form_tag_attrs: Dictionary of attributes to be added to
the form tag. 'accept-charset' and 'enctype' have defaults
that can be overridden. If a value is supplied for
'action' or 'method', it will be replaced.
@return... | [
"Returns",
"the",
"form",
"markup",
"for",
"this",
"response",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L990-L1003 | train |
openid/python-openid | openid/server/server.py | Signatory.verify | def verify(self, assoc_handle, message):
"""Verify that the signature for some data is valid.
@param assoc_handle: The handle of the association used to sign the
data.
@type assoc_handle: str
@param message: The signed message to verify
@type message: openid.message... | python | def verify(self, assoc_handle, message):
"""Verify that the signature for some data is valid.
@param assoc_handle: The handle of the association used to sign the
data.
@type assoc_handle: str
@param message: The signed message to verify
@type message: openid.message... | [
"def",
"verify",
"(",
"self",
",",
"assoc_handle",
",",
"message",
")",
":",
"assoc",
"=",
"self",
".",
"getAssociation",
"(",
"assoc_handle",
",",
"dumb",
"=",
"True",
")",
"if",
"not",
"assoc",
":",
"logging",
".",
"error",
"(",
"\"failed to get assoc wi... | Verify that the signature for some data is valid.
@param assoc_handle: The handle of the association used to sign the
data.
@type assoc_handle: str
@param message: The signed message to verify
@type message: openid.message.Message
@returns: C{True} if the signature... | [
"Verify",
"that",
"the",
"signature",
"for",
"some",
"data",
"is",
"valid",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1159-L1186 | train |
openid/python-openid | openid/server/server.py | Signatory.sign | def sign(self, response):
"""Sign a response.
I take a L{OpenIDResponse}, create a signature for everything
in its L{signed<OpenIDResponse.signed>} list, and return a new
copy of the response object with that signature included.
@param response: A response to sign.
@typ... | python | def sign(self, response):
"""Sign a response.
I take a L{OpenIDResponse}, create a signature for everything
in its L{signed<OpenIDResponse.signed>} list, and return a new
copy of the response object with that signature included.
@param response: A response to sign.
@typ... | [
"def",
"sign",
"(",
"self",
",",
"response",
")",
":",
"signed_response",
"=",
"deepcopy",
"(",
"response",
")",
"assoc_handle",
"=",
"response",
".",
"request",
".",
"assoc_handle",
"if",
"assoc_handle",
":",
"assoc",
"=",
"self",
".",
"getAssociation",
"("... | Sign a response.
I take a L{OpenIDResponse}, create a signature for everything
in its L{signed<OpenIDResponse.signed>} list, and return a new
copy of the response object with that signature included.
@param response: A response to sign.
@type response: L{OpenIDResponse}
... | [
"Sign",
"a",
"response",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1189-L1231 | train |
openid/python-openid | openid/server/server.py | Signatory.createAssociation | def createAssociation(self, dumb=True, assoc_type='HMAC-SHA1'):
"""Make a new association.
@param dumb: Is this association for a dumb-mode transaction?
@type dumb: bool
@param assoc_type: The type of association to create. Currently
there is only one type defined, C{HMAC-... | python | def createAssociation(self, dumb=True, assoc_type='HMAC-SHA1'):
"""Make a new association.
@param dumb: Is this association for a dumb-mode transaction?
@type dumb: bool
@param assoc_type: The type of association to create. Currently
there is only one type defined, C{HMAC-... | [
"def",
"createAssociation",
"(",
"self",
",",
"dumb",
"=",
"True",
",",
"assoc_type",
"=",
"'HMAC-SHA1'",
")",
":",
"secret",
"=",
"cryptutil",
".",
"getBytes",
"(",
"getSecretSize",
"(",
"assoc_type",
")",
")",
"uniq",
"=",
"oidutil",
".",
"toBase64",
"("... | Make a new association.
@param dumb: Is this association for a dumb-mode transaction?
@type dumb: bool
@param assoc_type: The type of association to create. Currently
there is only one type defined, C{HMAC-SHA1}.
@type assoc_type: str
@returns: the new association... | [
"Make",
"a",
"new",
"association",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1234-L1259 | train |
openid/python-openid | openid/server/server.py | Signatory.getAssociation | def getAssociation(self, assoc_handle, dumb, checkExpiration=True):
"""Get the association with the specified handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
@returns: the association, or None if no valid association with ... | python | def getAssociation(self, assoc_handle, dumb, checkExpiration=True):
"""Get the association with the specified handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
@returns: the association, or None if no valid association with ... | [
"def",
"getAssociation",
"(",
"self",
",",
"assoc_handle",
",",
"dumb",
",",
"checkExpiration",
"=",
"True",
")",
":",
"if",
"assoc_handle",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"assoc_handle must not be None\"",
")",
"if",
"dumb",
":",
"key",
"=",... | Get the association with the specified handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
@returns: the association, or None if no valid association with that
handle was found.
@returntype: L{openid.association.As... | [
"Get",
"the",
"association",
"with",
"the",
"specified",
"handle",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1262-L1295 | train |
openid/python-openid | openid/server/server.py | Signatory.invalidate | def invalidate(self, assoc_handle, dumb):
"""Invalidates the association with the given handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
"""
if dumb:
key = self._dumb_key
else:
key = s... | python | def invalidate(self, assoc_handle, dumb):
"""Invalidates the association with the given handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool
"""
if dumb:
key = self._dumb_key
else:
key = s... | [
"def",
"invalidate",
"(",
"self",
",",
"assoc_handle",
",",
"dumb",
")",
":",
"if",
"dumb",
":",
"key",
"=",
"self",
".",
"_dumb_key",
"else",
":",
"key",
"=",
"self",
".",
"_normal_key",
"self",
".",
"store",
".",
"removeAssociation",
"(",
"key",
",",... | Invalidates the association with the given handle.
@type assoc_handle: str
@param dumb: Is this association used with dumb mode?
@type dumb: bool | [
"Invalidates",
"the",
"association",
"with",
"the",
"given",
"handle",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1298-L1310 | train |
openid/python-openid | openid/server/server.py | Decoder.defaultDecoder | def defaultDecoder(self, message, server):
"""Called to decode queries when no handler for that mode is found.
@raises ProtocolError: This implementation always raises
L{ProtocolError}.
"""
mode = message.getArg(OPENID_NS, 'mode')
fmt = "Unrecognized OpenID mode %r"
... | python | def defaultDecoder(self, message, server):
"""Called to decode queries when no handler for that mode is found.
@raises ProtocolError: This implementation always raises
L{ProtocolError}.
"""
mode = message.getArg(OPENID_NS, 'mode')
fmt = "Unrecognized OpenID mode %r"
... | [
"def",
"defaultDecoder",
"(",
"self",
",",
"message",
",",
"server",
")",
":",
"mode",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'mode'",
")",
"fmt",
"=",
"\"Unrecognized OpenID mode %r\"",
"raise",
"ProtocolError",
"(",
"message",
",",
"text",
... | Called to decode queries when no handler for that mode is found.
@raises ProtocolError: This implementation always raises
L{ProtocolError}. | [
"Called",
"to",
"decode",
"queries",
"when",
"no",
"handler",
"for",
"that",
"mode",
"is",
"found",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1448-L1456 | train |
openid/python-openid | openid/server/server.py | ProtocolError.toMessage | def toMessage(self):
"""Generate a Message object for sending to the relying party,
after encoding.
"""
namespace = self.openid_message.getOpenIDNamespace()
reply = Message(namespace)
reply.setArg(OPENID_NS, 'mode', 'error')
reply.setArg(OPENID_NS, 'error', str(se... | python | def toMessage(self):
"""Generate a Message object for sending to the relying party,
after encoding.
"""
namespace = self.openid_message.getOpenIDNamespace()
reply = Message(namespace)
reply.setArg(OPENID_NS, 'mode', 'error')
reply.setArg(OPENID_NS, 'error', str(se... | [
"def",
"toMessage",
"(",
"self",
")",
":",
"namespace",
"=",
"self",
".",
"openid_message",
".",
"getOpenIDNamespace",
"(",
")",
"reply",
"=",
"Message",
"(",
"namespace",
")",
"reply",
".",
"setArg",
"(",
"OPENID_NS",
",",
"'mode'",
",",
"'error'",
")",
... | Generate a Message object for sending to the relying party,
after encoding. | [
"Generate",
"a",
"Message",
"object",
"for",
"sending",
"to",
"the",
"relying",
"party",
"after",
"encoding",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1674-L1689 | train |
openid/python-openid | examples/djopenid/consumer/views.py | rpXRDS | def rpXRDS(request):
"""
Return a relying party verification XRDS document
"""
return util.renderXRDS(
request,
[RP_RETURN_TO_URL_TYPE],
[util.getViewURL(request, finishOpenID)]) | python | def rpXRDS(request):
"""
Return a relying party verification XRDS document
"""
return util.renderXRDS(
request,
[RP_RETURN_TO_URL_TYPE],
[util.getViewURL(request, finishOpenID)]) | [
"def",
"rpXRDS",
"(",
"request",
")",
":",
"return",
"util",
".",
"renderXRDS",
"(",
"request",
",",
"[",
"RP_RETURN_TO_URL_TYPE",
"]",
",",
"[",
"util",
".",
"getViewURL",
"(",
"request",
",",
"finishOpenID",
")",
"]",
")"
] | Return a relying party verification XRDS document | [
"Return",
"a",
"relying",
"party",
"verification",
"XRDS",
"document"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/djopenid/consumer/views.py#L213-L220 | train |
openid/python-openid | examples/consumer.py | OpenIDRequestHandler.getSession | def getSession(self):
"""Return the existing session or a new session"""
if self.session is not None:
return self.session
# Get value of cookie header that was sent
cookie_str = self.headers.get('Cookie')
if cookie_str:
cookie_obj = SimpleCookie(cookie_st... | python | def getSession(self):
"""Return the existing session or a new session"""
if self.session is not None:
return self.session
# Get value of cookie header that was sent
cookie_str = self.headers.get('Cookie')
if cookie_str:
cookie_obj = SimpleCookie(cookie_st... | [
"def",
"getSession",
"(",
"self",
")",
":",
"if",
"self",
".",
"session",
"is",
"not",
"None",
":",
"return",
"self",
".",
"session",
"cookie_str",
"=",
"self",
".",
"headers",
".",
"get",
"(",
"'Cookie'",
")",
"if",
"cookie_str",
":",
"cookie_obj",
"=... | Return the existing session or a new session | [
"Return",
"the",
"existing",
"session",
"or",
"a",
"new",
"session"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/consumer.py#L77-L107 | train |
openid/python-openid | examples/consumer.py | OpenIDRequestHandler.doProcess | def doProcess(self):
"""Handle the redirect from the OpenID server.
"""
oidconsumer = self.getConsumer()
# Ask the library to check the response that the server sent
# us. Status is a code indicating the response type. info is
# either None or a string containing more i... | python | def doProcess(self):
"""Handle the redirect from the OpenID server.
"""
oidconsumer = self.getConsumer()
# Ask the library to check the response that the server sent
# us. Status is a code indicating the response type. info is
# either None or a string containing more i... | [
"def",
"doProcess",
"(",
"self",
")",
":",
"oidconsumer",
"=",
"self",
".",
"getConsumer",
"(",
")",
"url",
"=",
"'http://'",
"+",
"self",
".",
"headers",
".",
"get",
"(",
"'Host'",
")",
"+",
"self",
".",
"path",
"info",
"=",
"oidconsumer",
".",
"com... | Handle the redirect from the OpenID server. | [
"Handle",
"the",
"redirect",
"from",
"the",
"OpenID",
"server",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/consumer.py#L222-L285 | train |
openid/python-openid | examples/consumer.py | OpenIDRequestHandler.notFound | def notFound(self):
"""Render a page with a 404 return code and a message."""
fmt = 'The path <q>%s</q> was not understood by this server.'
msg = fmt % (self.path,)
openid_url = self.query.get('openid_identifier')
self.render(msg, 'error', openid_url, status=404) | python | def notFound(self):
"""Render a page with a 404 return code and a message."""
fmt = 'The path <q>%s</q> was not understood by this server.'
msg = fmt % (self.path,)
openid_url = self.query.get('openid_identifier')
self.render(msg, 'error', openid_url, status=404) | [
"def",
"notFound",
"(",
"self",
")",
":",
"fmt",
"=",
"'The path <q>%s</q> was not understood by this server.'",
"msg",
"=",
"fmt",
"%",
"(",
"self",
".",
"path",
",",
")",
"openid_url",
"=",
"self",
".",
"query",
".",
"get",
"(",
"'openid_identifier'",
")",
... | Render a page with a 404 return code and a message. | [
"Render",
"a",
"page",
"with",
"a",
"404",
"return",
"code",
"and",
"a",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/consumer.py#L343-L348 | train |
openid/python-openid | examples/consumer.py | OpenIDRequestHandler.render | def render(self, message=None, css_class='alert', form_contents=None,
status=200, title="Python OpenID Consumer Example",
sreg_data=None, pape_data=None):
"""Render a page."""
self.send_response(status)
self.pageHeader(title)
if message:
self.wfi... | python | def render(self, message=None, css_class='alert', form_contents=None,
status=200, title="Python OpenID Consumer Example",
sreg_data=None, pape_data=None):
"""Render a page."""
self.send_response(status)
self.pageHeader(title)
if message:
self.wfi... | [
"def",
"render",
"(",
"self",
",",
"message",
"=",
"None",
",",
"css_class",
"=",
"'alert'",
",",
"form_contents",
"=",
"None",
",",
"status",
"=",
"200",
",",
"title",
"=",
"\"Python OpenID Consumer Example\"",
",",
"sreg_data",
"=",
"None",
",",
"pape_data... | Render a page. | [
"Render",
"a",
"page",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/consumer.py#L350-L367 | train |
openid/python-openid | openid/store/sqlstore.py | SQLStore._callInTransaction | def _callInTransaction(self, func, *args, **kwargs):
"""Execute the given function inside of a transaction, with an
open cursor. If no exception is raised, the transaction is
comitted, otherwise it is rolled back."""
# No nesting of transactions
self.conn.rollback()
try:... | python | def _callInTransaction(self, func, *args, **kwargs):
"""Execute the given function inside of a transaction, with an
open cursor. If no exception is raised, the transaction is
comitted, otherwise it is rolled back."""
# No nesting of transactions
self.conn.rollback()
try:... | [
"def",
"_callInTransaction",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"conn",
".",
"rollback",
"(",
")",
"try",
":",
"self",
".",
"cur",
"=",
"self",
".",
"conn",
".",
"cursor",
"(",
")",
"try",
":",... | Execute the given function inside of a transaction, with an
open cursor. If no exception is raised, the transaction is
comitted, otherwise it is rolled back. | [
"Execute",
"the",
"given",
"function",
"inside",
"of",
"a",
"transaction",
"with",
"an",
"open",
"cursor",
".",
"If",
"no",
"exception",
"is",
"raised",
"the",
"transaction",
"is",
"comitted",
"otherwise",
"it",
"is",
"rolled",
"back",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/sqlstore.py#L162-L182 | train |
openid/python-openid | openid/store/sqlstore.py | SQLStore.txn_storeAssociation | def txn_storeAssociation(self, server_url, association):
"""Set the association for the server URL.
Association -> NoneType
"""
a = association
self.db_set_assoc(
server_url,
a.handle,
self.blobEncode(a.secret),
a.issued,
... | python | def txn_storeAssociation(self, server_url, association):
"""Set the association for the server URL.
Association -> NoneType
"""
a = association
self.db_set_assoc(
server_url,
a.handle,
self.blobEncode(a.secret),
a.issued,
... | [
"def",
"txn_storeAssociation",
"(",
"self",
",",
"server_url",
",",
"association",
")",
":",
"a",
"=",
"association",
"self",
".",
"db_set_assoc",
"(",
"server_url",
",",
"a",
".",
"handle",
",",
"self",
".",
"blobEncode",
"(",
"a",
".",
"secret",
")",
"... | Set the association for the server URL.
Association -> NoneType | [
"Set",
"the",
"association",
"for",
"the",
"server",
"URL",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/sqlstore.py#L195-L207 | train |
openid/python-openid | openid/store/sqlstore.py | SQLStore.txn_removeAssociation | def txn_removeAssociation(self, server_url, handle):
"""Remove the association for the given server URL and handle,
returning whether the association existed at all.
(str, str) -> bool
"""
self.db_remove_assoc(server_url, handle)
return self.cur.rowcount > 0 | python | def txn_removeAssociation(self, server_url, handle):
"""Remove the association for the given server URL and handle,
returning whether the association existed at all.
(str, str) -> bool
"""
self.db_remove_assoc(server_url, handle)
return self.cur.rowcount > 0 | [
"def",
"txn_removeAssociation",
"(",
"self",
",",
"server_url",
",",
"handle",
")",
":",
"self",
".",
"db_remove_assoc",
"(",
"server_url",
",",
"handle",
")",
"return",
"self",
".",
"cur",
".",
"rowcount",
">",
"0"
] | Remove the association for the given server URL and handle,
returning whether the association existed at all.
(str, str) -> bool | [
"Remove",
"the",
"association",
"for",
"the",
"given",
"server",
"URL",
"and",
"handle",
"returning",
"whether",
"the",
"association",
"existed",
"at",
"all",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/sqlstore.py#L243-L250 | train |
openid/python-openid | openid/store/sqlstore.py | SQLStore.txn_useNonce | def txn_useNonce(self, server_url, timestamp, salt):
"""Return whether this nonce is present, and if it is, then
remove it from the set.
str -> bool"""
if abs(timestamp - time.time()) > nonce.SKEW:
return False
try:
self.db_add_nonce(server_url, timestam... | python | def txn_useNonce(self, server_url, timestamp, salt):
"""Return whether this nonce is present, and if it is, then
remove it from the set.
str -> bool"""
if abs(timestamp - time.time()) > nonce.SKEW:
return False
try:
self.db_add_nonce(server_url, timestam... | [
"def",
"txn_useNonce",
"(",
"self",
",",
"server_url",
",",
"timestamp",
",",
"salt",
")",
":",
"if",
"abs",
"(",
"timestamp",
"-",
"time",
".",
"time",
"(",
")",
")",
">",
"nonce",
".",
"SKEW",
":",
"return",
"False",
"try",
":",
"self",
".",
"db_... | Return whether this nonce is present, and if it is, then
remove it from the set.
str -> bool | [
"Return",
"whether",
"this",
"nonce",
"is",
"present",
"and",
"if",
"it",
"is",
"then",
"remove",
"it",
"from",
"the",
"set",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/sqlstore.py#L254-L269 | train |
openid/python-openid | openid/yadis/xri.py | _escape_xref | def _escape_xref(xref_match):
"""Escape things that need to be escaped if they're in a cross-reference.
"""
xref = xref_match.group()
xref = xref.replace('/', '%2F')
xref = xref.replace('?', '%3F')
xref = xref.replace('#', '%23')
return xref | python | def _escape_xref(xref_match):
"""Escape things that need to be escaped if they're in a cross-reference.
"""
xref = xref_match.group()
xref = xref.replace('/', '%2F')
xref = xref.replace('?', '%3F')
xref = xref.replace('#', '%23')
return xref | [
"def",
"_escape_xref",
"(",
"xref_match",
")",
":",
"xref",
"=",
"xref_match",
".",
"group",
"(",
")",
"xref",
"=",
"xref",
".",
"replace",
"(",
"'/'",
",",
"'%2F'",
")",
"xref",
"=",
"xref",
".",
"replace",
"(",
"'?'",
",",
"'%3F'",
")",
"xref",
"... | Escape things that need to be escaped if they're in a cross-reference. | [
"Escape",
"things",
"that",
"need",
"to",
"be",
"escaped",
"if",
"they",
"re",
"in",
"a",
"cross",
"-",
"reference",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xri.py#L79-L86 | train |
openid/python-openid | openid/yadis/xri.py | escapeForIRI | def escapeForIRI(xri):
"""Escape things that need to be escaped when transforming to an IRI."""
xri = xri.replace('%', '%25')
xri = _xref_re.sub(_escape_xref, xri)
return xri | python | def escapeForIRI(xri):
"""Escape things that need to be escaped when transforming to an IRI."""
xri = xri.replace('%', '%25')
xri = _xref_re.sub(_escape_xref, xri)
return xri | [
"def",
"escapeForIRI",
"(",
"xri",
")",
":",
"xri",
"=",
"xri",
".",
"replace",
"(",
"'%'",
",",
"'%25'",
")",
"xri",
"=",
"_xref_re",
".",
"sub",
"(",
"_escape_xref",
",",
"xri",
")",
"return",
"xri"
] | Escape things that need to be escaped when transforming to an IRI. | [
"Escape",
"things",
"that",
"need",
"to",
"be",
"escaped",
"when",
"transforming",
"to",
"an",
"IRI",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xri.py#L89-L93 | train |
openid/python-openid | openid/yadis/xri.py | providerIsAuthoritative | def providerIsAuthoritative(providerID, canonicalID):
"""Is this provider ID authoritative for this XRI?
@returntype: bool
"""
# XXX: can't use rsplit until we require python >= 2.4.
lastbang = canonicalID.rindex('!')
parent = canonicalID[:lastbang]
return parent == providerID | python | def providerIsAuthoritative(providerID, canonicalID):
"""Is this provider ID authoritative for this XRI?
@returntype: bool
"""
# XXX: can't use rsplit until we require python >= 2.4.
lastbang = canonicalID.rindex('!')
parent = canonicalID[:lastbang]
return parent == providerID | [
"def",
"providerIsAuthoritative",
"(",
"providerID",
",",
"canonicalID",
")",
":",
"lastbang",
"=",
"canonicalID",
".",
"rindex",
"(",
"'!'",
")",
"parent",
"=",
"canonicalID",
"[",
":",
"lastbang",
"]",
"return",
"parent",
"==",
"providerID"
] | Is this provider ID authoritative for this XRI?
@returntype: bool | [
"Is",
"this",
"provider",
"ID",
"authoritative",
"for",
"this",
"XRI?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xri.py#L112-L120 | train |
openid/python-openid | openid/yadis/xri.py | rootAuthority | def rootAuthority(xri):
"""Return the root authority for an XRI.
Example::
rootAuthority("xri://@example") == "xri://@"
@type xri: unicode
@returntype: unicode
"""
if xri.startswith('xri://'):
xri = xri[6:]
authority = xri.split('/', 1)[0]
if authority[0] == '(':
... | python | def rootAuthority(xri):
"""Return the root authority for an XRI.
Example::
rootAuthority("xri://@example") == "xri://@"
@type xri: unicode
@returntype: unicode
"""
if xri.startswith('xri://'):
xri = xri[6:]
authority = xri.split('/', 1)[0]
if authority[0] == '(':
... | [
"def",
"rootAuthority",
"(",
"xri",
")",
":",
"if",
"xri",
".",
"startswith",
"(",
"'xri://'",
")",
":",
"xri",
"=",
"xri",
"[",
"6",
":",
"]",
"authority",
"=",
"xri",
".",
"split",
"(",
"'/'",
",",
"1",
")",
"[",
"0",
"]",
"if",
"authority",
... | Return the root authority for an XRI.
Example::
rootAuthority("xri://@example") == "xri://@"
@type xri: unicode
@returntype: unicode | [
"Return",
"the",
"root",
"authority",
"for",
"an",
"XRI",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/xri.py#L123-L153 | train |
openid/python-openid | openid/extension.py | Extension.toMessage | def toMessage(self, message=None):
"""Add the arguments from this extension to the provided
message, or create a new message containing only those
arguments.
@returns: The message with the extension arguments added
"""
if message is None:
warnings.warn('Passi... | python | def toMessage(self, message=None):
"""Add the arguments from this extension to the provided
message, or create a new message containing only those
arguments.
@returns: The message with the extension arguments added
"""
if message is None:
warnings.warn('Passi... | [
"def",
"toMessage",
"(",
"self",
",",
"message",
"=",
"None",
")",
":",
"if",
"message",
"is",
"None",
":",
"warnings",
".",
"warn",
"(",
"'Passing None to Extension.toMessage is deprecated. '",
"'Creating a message assuming you want OpenID 2.'",
",",
"DeprecationWarning"... | Add the arguments from this extension to the provided
message, or create a new message containing only those
arguments.
@returns: The message with the extension arguments added | [
"Add",
"the",
"arguments",
"from",
"this",
"extension",
"to",
"the",
"provided",
"message",
"or",
"create",
"a",
"new",
"message",
"containing",
"only",
"those",
"arguments",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extension.py#L23-L46 | train |
openid/python-openid | openid/store/filestore.py | _ensureDir | def _ensureDir(dir_name):
"""Create dir_name as a directory if it does not exist. If it
exists, make sure that it is, in fact, a directory.
Can raise OSError
str -> NoneType
"""
try:
os.makedirs(dir_name)
except OSError, why:
if why.errno != EEXIST or not os.path.isdir(dir_... | python | def _ensureDir(dir_name):
"""Create dir_name as a directory if it does not exist. If it
exists, make sure that it is, in fact, a directory.
Can raise OSError
str -> NoneType
"""
try:
os.makedirs(dir_name)
except OSError, why:
if why.errno != EEXIST or not os.path.isdir(dir_... | [
"def",
"_ensureDir",
"(",
"dir_name",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"dir_name",
")",
"except",
"OSError",
",",
"why",
":",
"if",
"why",
".",
"errno",
"!=",
"EEXIST",
"or",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"dir_name",
... | Create dir_name as a directory if it does not exist. If it
exists, make sure that it is, in fact, a directory.
Can raise OSError
str -> NoneType | [
"Create",
"dir_name",
"as",
"a",
"directory",
"if",
"it",
"does",
"not",
"exist",
".",
"If",
"it",
"exists",
"make",
"sure",
"that",
"it",
"is",
"in",
"fact",
"a",
"directory",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L96-L108 | train |
openid/python-openid | openid/store/filestore.py | FileOpenIDStore._setup | def _setup(self):
"""Make sure that the directories in which we store our data
exist.
() -> NoneType
"""
_ensureDir(self.nonce_dir)
_ensureDir(self.association_dir)
_ensureDir(self.temp_dir) | python | def _setup(self):
"""Make sure that the directories in which we store our data
exist.
() -> NoneType
"""
_ensureDir(self.nonce_dir)
_ensureDir(self.association_dir)
_ensureDir(self.temp_dir) | [
"def",
"_setup",
"(",
"self",
")",
":",
"_ensureDir",
"(",
"self",
".",
"nonce_dir",
")",
"_ensureDir",
"(",
"self",
".",
"association_dir",
")",
"_ensureDir",
"(",
"self",
".",
"temp_dir",
")"
] | Make sure that the directories in which we store our data
exist.
() -> NoneType | [
"Make",
"sure",
"that",
"the",
"directories",
"in",
"which",
"we",
"store",
"our",
"data",
"exist",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L153-L161 | train |
openid/python-openid | openid/store/filestore.py | FileOpenIDStore._mktemp | def _mktemp(self):
"""Create a temporary file on the same filesystem as
self.association_dir.
The temporary directory should not be cleaned if there are any
processes using the store. If there is no active process using
the store, it is safe to remove all of the files in the
... | python | def _mktemp(self):
"""Create a temporary file on the same filesystem as
self.association_dir.
The temporary directory should not be cleaned if there are any
processes using the store. If there is no active process using
the store, it is safe to remove all of the files in the
... | [
"def",
"_mktemp",
"(",
"self",
")",
":",
"fd",
",",
"name",
"=",
"mkstemp",
"(",
"dir",
"=",
"self",
".",
"temp_dir",
")",
"try",
":",
"file_obj",
"=",
"os",
".",
"fdopen",
"(",
"fd",
",",
"'wb'",
")",
"return",
"file_obj",
",",
"name",
"except",
... | Create a temporary file on the same filesystem as
self.association_dir.
The temporary directory should not be cleaned if there are any
processes using the store. If there is no active process using
the store, it is safe to remove all of the files in the
temporary directory.
... | [
"Create",
"a",
"temporary",
"file",
"on",
"the",
"same",
"filesystem",
"as",
"self",
".",
"association_dir",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L163-L180 | train |
openid/python-openid | openid/store/filestore.py | FileOpenIDStore.getAssociationFilename | def getAssociationFilename(self, server_url, handle):
"""Create a unique filename for a given server url and
handle. This implementation does not assume anything about the
format of the handle. The filename that is returned will
contain the domain name from the server URL for ease of hum... | python | def getAssociationFilename(self, server_url, handle):
"""Create a unique filename for a given server url and
handle. This implementation does not assume anything about the
format of the handle. The filename that is returned will
contain the domain name from the server URL for ease of hum... | [
"def",
"getAssociationFilename",
"(",
"self",
",",
"server_url",
",",
"handle",
")",
":",
"if",
"server_url",
".",
"find",
"(",
"'://'",
")",
"==",
"-",
"1",
":",
"raise",
"ValueError",
"(",
"'Bad server URL: %r'",
"%",
"server_url",
")",
"proto",
",",
"re... | Create a unique filename for a given server url and
handle. This implementation does not assume anything about the
format of the handle. The filename that is returned will
contain the domain name from the server URL for ease of human
inspection of the data directory.
(str, str) ... | [
"Create",
"a",
"unique",
"filename",
"for",
"a",
"given",
"server",
"url",
"and",
"handle",
".",
"This",
"implementation",
"does",
"not",
"assume",
"anything",
"about",
"the",
"format",
"of",
"the",
"handle",
".",
"The",
"filename",
"that",
"is",
"returned",... | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L182-L204 | train |
openid/python-openid | openid/store/filestore.py | FileOpenIDStore.getAssociation | def getAssociation(self, server_url, handle=None):
"""Retrieve an association. If no handle is specified, return
the association with the latest expiration.
(str, str or NoneType) -> Association or NoneType
"""
if handle is None:
handle = ''
# The filename w... | python | def getAssociation(self, server_url, handle=None):
"""Retrieve an association. If no handle is specified, return
the association with the latest expiration.
(str, str or NoneType) -> Association or NoneType
"""
if handle is None:
handle = ''
# The filename w... | [
"def",
"getAssociation",
"(",
"self",
",",
"server_url",
",",
"handle",
"=",
"None",
")",
":",
"if",
"handle",
"is",
"None",
":",
"handle",
"=",
"''",
"filename",
"=",
"self",
".",
"getAssociationFilename",
"(",
"server_url",
",",
"handle",
")",
"if",
"h... | Retrieve an association. If no handle is specified, return
the association with the latest expiration.
(str, str or NoneType) -> Association or NoneType | [
"Retrieve",
"an",
"association",
".",
"If",
"no",
"handle",
"is",
"specified",
"return",
"the",
"association",
"with",
"the",
"latest",
"expiration",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L248-L288 | train |
openid/python-openid | openid/store/filestore.py | FileOpenIDStore.removeAssociation | def removeAssociation(self, server_url, handle):
"""Remove an association if it exists. Do nothing if it does not.
(str, str) -> bool
"""
assoc = self.getAssociation(server_url, handle)
if assoc is None:
return 0
else:
filename = self.getAssociati... | python | def removeAssociation(self, server_url, handle):
"""Remove an association if it exists. Do nothing if it does not.
(str, str) -> bool
"""
assoc = self.getAssociation(server_url, handle)
if assoc is None:
return 0
else:
filename = self.getAssociati... | [
"def",
"removeAssociation",
"(",
"self",
",",
"server_url",
",",
"handle",
")",
":",
"assoc",
"=",
"self",
".",
"getAssociation",
"(",
"server_url",
",",
"handle",
")",
"if",
"assoc",
"is",
"None",
":",
"return",
"0",
"else",
":",
"filename",
"=",
"self"... | Remove an association if it exists. Do nothing if it does not.
(str, str) -> bool | [
"Remove",
"an",
"association",
"if",
"it",
"exists",
".",
"Do",
"nothing",
"if",
"it",
"does",
"not",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L318-L328 | train |
openid/python-openid | openid/store/filestore.py | FileOpenIDStore.useNonce | def useNonce(self, server_url, timestamp, salt):
"""Return whether this nonce is valid.
str -> bool
"""
if abs(timestamp - time.time()) > nonce.SKEW:
return False
if server_url:
proto, rest = server_url.split('://', 1)
else:
# Create ... | python | def useNonce(self, server_url, timestamp, salt):
"""Return whether this nonce is valid.
str -> bool
"""
if abs(timestamp - time.time()) > nonce.SKEW:
return False
if server_url:
proto, rest = server_url.split('://', 1)
else:
# Create ... | [
"def",
"useNonce",
"(",
"self",
",",
"server_url",
",",
"timestamp",
",",
"salt",
")",
":",
"if",
"abs",
"(",
"timestamp",
"-",
"time",
".",
"time",
"(",
")",
")",
">",
"nonce",
".",
"SKEW",
":",
"return",
"False",
"if",
"server_url",
":",
"proto",
... | Return whether this nonce is valid.
str -> bool | [
"Return",
"whether",
"this",
"nonce",
"is",
"valid",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/filestore.py#L330-L362 | train |
openid/python-openid | openid/consumer/discover.py | arrangeByType | def arrangeByType(service_list, preferred_types):
"""Rearrange service_list in a new list so services are ordered by
types listed in preferred_types. Return the new list."""
def enumerate(elts):
"""Return an iterable that pairs the index of an element with
that element.
For Python... | python | def arrangeByType(service_list, preferred_types):
"""Rearrange service_list in a new list so services are ordered by
types listed in preferred_types. Return the new list."""
def enumerate(elts):
"""Return an iterable that pairs the index of an element with
that element.
For Python... | [
"def",
"arrangeByType",
"(",
"service_list",
",",
"preferred_types",
")",
":",
"def",
"enumerate",
"(",
"elts",
")",
":",
"return",
"zip",
"(",
"range",
"(",
"len",
"(",
"elts",
")",
")",
",",
"elts",
")",
"def",
"bestMatchingService",
"(",
"service",
")... | Rearrange service_list in a new list so services are ordered by
types listed in preferred_types. Return the new list. | [
"Rearrange",
"service_list",
"in",
"a",
"new",
"list",
"so",
"services",
"are",
"ordered",
"by",
"types",
"listed",
"in",
"preferred_types",
".",
"Return",
"the",
"new",
"list",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L319-L356 | train |
openid/python-openid | openid/consumer/discover.py | getOPOrUserServices | def getOPOrUserServices(openid_services):
"""Extract OP Identifier services. If none found, return the
rest, sorted with most preferred first according to
OpenIDServiceEndpoint.openid_type_uris.
openid_services is a list of OpenIDServiceEndpoint objects.
Returns a list of OpenIDServiceEndpoint ob... | python | def getOPOrUserServices(openid_services):
"""Extract OP Identifier services. If none found, return the
rest, sorted with most preferred first according to
OpenIDServiceEndpoint.openid_type_uris.
openid_services is a list of OpenIDServiceEndpoint objects.
Returns a list of OpenIDServiceEndpoint ob... | [
"def",
"getOPOrUserServices",
"(",
"openid_services",
")",
":",
"op_services",
"=",
"arrangeByType",
"(",
"openid_services",
",",
"[",
"OPENID_IDP_2_0_TYPE",
"]",
")",
"openid_services",
"=",
"arrangeByType",
"(",
"openid_services",
",",
"OpenIDServiceEndpoint",
".",
... | Extract OP Identifier services. If none found, return the
rest, sorted with most preferred first according to
OpenIDServiceEndpoint.openid_type_uris.
openid_services is a list of OpenIDServiceEndpoint objects.
Returns a list of OpenIDServiceEndpoint objects. | [
"Extract",
"OP",
"Identifier",
"services",
".",
"If",
"none",
"found",
"return",
"the",
"rest",
"sorted",
"with",
"most",
"preferred",
"first",
"according",
"to",
"OpenIDServiceEndpoint",
".",
"openid_type_uris",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L358-L372 | train |
openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.supportsType | def supportsType(self, type_uri):
"""Does this endpoint support this type?
I consider C{/server} endpoints to implicitly support C{/signon}.
"""
return (
(type_uri in self.type_uris) or
(type_uri == OPENID_2_0_TYPE and self.isOPIdentifier())
) | python | def supportsType(self, type_uri):
"""Does this endpoint support this type?
I consider C{/server} endpoints to implicitly support C{/signon}.
"""
return (
(type_uri in self.type_uris) or
(type_uri == OPENID_2_0_TYPE and self.isOPIdentifier())
) | [
"def",
"supportsType",
"(",
"self",
",",
"type_uri",
")",
":",
"return",
"(",
"(",
"type_uri",
"in",
"self",
".",
"type_uris",
")",
"or",
"(",
"type_uri",
"==",
"OPENID_2_0_TYPE",
"and",
"self",
".",
"isOPIdentifier",
"(",
")",
")",
")"
] | Does this endpoint support this type?
I consider C{/server} endpoints to implicitly support C{/signon}. | [
"Does",
"this",
"endpoint",
"support",
"this",
"type?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L76-L84 | train |
openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.parseService | def parseService(self, yadis_url, uri, type_uris, service_element):
"""Set the state of this object based on the contents of the
service element."""
self.type_uris = type_uris
self.server_url = uri
self.used_yadis = True
if not self.isOPIdentifier():
# XXX: T... | python | def parseService(self, yadis_url, uri, type_uris, service_element):
"""Set the state of this object based on the contents of the
service element."""
self.type_uris = type_uris
self.server_url = uri
self.used_yadis = True
if not self.isOPIdentifier():
# XXX: T... | [
"def",
"parseService",
"(",
"self",
",",
"yadis_url",
",",
"uri",
",",
"type_uris",
",",
"service_element",
")",
":",
"self",
".",
"type_uris",
"=",
"type_uris",
"self",
".",
"server_url",
"=",
"uri",
"self",
".",
"used_yadis",
"=",
"True",
"if",
"not",
... | Set the state of this object based on the contents of the
service element. | [
"Set",
"the",
"state",
"of",
"this",
"object",
"based",
"on",
"the",
"contents",
"of",
"the",
"service",
"element",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L102-L116 | train |
openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.getLocalID | def getLocalID(self):
"""Return the identifier that should be sent as the
openid.identity parameter to the server."""
# I looked at this conditional and thought "ah-hah! there's the bug!"
# but Python actually makes that one big expression somehow, i.e.
# "x is x is x" is not the... | python | def getLocalID(self):
"""Return the identifier that should be sent as the
openid.identity parameter to the server."""
# I looked at this conditional and thought "ah-hah! there's the bug!"
# but Python actually makes that one big expression somehow, i.e.
# "x is x is x" is not the... | [
"def",
"getLocalID",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"local_id",
"is",
"self",
".",
"canonicalID",
"is",
"None",
")",
":",
"return",
"self",
".",
"claimed_id",
"else",
":",
"return",
"self",
".",
"local_id",
"or",
"self",
".",
"canonical... | Return the identifier that should be sent as the
openid.identity parameter to the server. | [
"Return",
"the",
"identifier",
"that",
"should",
"be",
"sent",
"as",
"the",
"openid",
".",
"identity",
"parameter",
"to",
"the",
"server",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L118-L128 | train |
openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.fromBasicServiceEndpoint | def fromBasicServiceEndpoint(cls, endpoint):
"""Create a new instance of this class from the endpoint
object passed in.
@return: None or OpenIDServiceEndpoint for this endpoint object"""
type_uris = endpoint.matchTypes(cls.openid_type_uris)
# If any Type URIs match and there is... | python | def fromBasicServiceEndpoint(cls, endpoint):
"""Create a new instance of this class from the endpoint
object passed in.
@return: None or OpenIDServiceEndpoint for this endpoint object"""
type_uris = endpoint.matchTypes(cls.openid_type_uris)
# If any Type URIs match and there is... | [
"def",
"fromBasicServiceEndpoint",
"(",
"cls",
",",
"endpoint",
")",
":",
"type_uris",
"=",
"endpoint",
".",
"matchTypes",
"(",
"cls",
".",
"openid_type_uris",
")",
"if",
"type_uris",
"and",
"endpoint",
".",
"uri",
"is",
"not",
"None",
":",
"openid_endpoint",
... | Create a new instance of this class from the endpoint
object passed in.
@return: None or OpenIDServiceEndpoint for this endpoint object | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"from",
"the",
"endpoint",
"object",
"passed",
"in",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L130-L149 | train |
openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.fromDiscoveryResult | def fromDiscoveryResult(cls, discoveryResult):
"""Create endpoints from a DiscoveryResult.
@type discoveryResult: L{DiscoveryResult}
@rtype: list of L{OpenIDServiceEndpoint}
@raises XRDSError: When the XRDS does not parse.
@since: 2.1.0
"""
if discoveryResult.... | python | def fromDiscoveryResult(cls, discoveryResult):
"""Create endpoints from a DiscoveryResult.
@type discoveryResult: L{DiscoveryResult}
@rtype: list of L{OpenIDServiceEndpoint}
@raises XRDSError: When the XRDS does not parse.
@since: 2.1.0
"""
if discoveryResult.... | [
"def",
"fromDiscoveryResult",
"(",
"cls",
",",
"discoveryResult",
")",
":",
"if",
"discoveryResult",
".",
"isXRDS",
"(",
")",
":",
"method",
"=",
"cls",
".",
"fromXRDS",
"else",
":",
"method",
"=",
"cls",
".",
"fromHTML",
"return",
"method",
"(",
"discover... | Create endpoints from a DiscoveryResult.
@type discoveryResult: L{DiscoveryResult}
@rtype: list of L{OpenIDServiceEndpoint}
@raises XRDSError: When the XRDS does not parse.
@since: 2.1.0 | [
"Create",
"endpoints",
"from",
"a",
"DiscoveryResult",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L200-L216 | train |
openid/python-openid | openid/consumer/discover.py | OpenIDServiceEndpoint.fromOPEndpointURL | def fromOPEndpointURL(cls, op_endpoint_url):
"""Construct an OP-Identifier OpenIDServiceEndpoint object for
a given OP Endpoint URL
@param op_endpoint_url: The URL of the endpoint
@rtype: OpenIDServiceEndpoint
"""
service = cls()
service.server_url = op_endpoint_... | python | def fromOPEndpointURL(cls, op_endpoint_url):
"""Construct an OP-Identifier OpenIDServiceEndpoint object for
a given OP Endpoint URL
@param op_endpoint_url: The URL of the endpoint
@rtype: OpenIDServiceEndpoint
"""
service = cls()
service.server_url = op_endpoint_... | [
"def",
"fromOPEndpointURL",
"(",
"cls",
",",
"op_endpoint_url",
")",
":",
"service",
"=",
"cls",
"(",
")",
"service",
".",
"server_url",
"=",
"op_endpoint_url",
"service",
".",
"type_uris",
"=",
"[",
"OPENID_IDP_2_0_TYPE",
"]",
"return",
"service"
] | Construct an OP-Identifier OpenIDServiceEndpoint object for
a given OP Endpoint URL
@param op_endpoint_url: The URL of the endpoint
@rtype: OpenIDServiceEndpoint | [
"Construct",
"an",
"OP",
"-",
"Identifier",
"OpenIDServiceEndpoint",
"object",
"for",
"a",
"given",
"OP",
"Endpoint",
"URL"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L221-L231 | train |
openid/python-openid | openid/association.py | SessionNegotiator.setAllowedTypes | def setAllowedTypes(self, allowed_types):
"""Set the allowed association types, checking to make sure
each combination is valid."""
for (assoc_type, session_type) in allowed_types:
checkSessionType(assoc_type, session_type)
self.allowed_types = allowed_types | python | def setAllowedTypes(self, allowed_types):
"""Set the allowed association types, checking to make sure
each combination is valid."""
for (assoc_type, session_type) in allowed_types:
checkSessionType(assoc_type, session_type)
self.allowed_types = allowed_types | [
"def",
"setAllowedTypes",
"(",
"self",
",",
"allowed_types",
")",
":",
"for",
"(",
"assoc_type",
",",
"session_type",
")",
"in",
"allowed_types",
":",
"checkSessionType",
"(",
"assoc_type",
",",
"session_type",
")",
"self",
".",
"allowed_types",
"=",
"allowed_ty... | Set the allowed association types, checking to make sure
each combination is valid. | [
"Set",
"the",
"allowed",
"association",
"types",
"checking",
"to",
"make",
"sure",
"each",
"combination",
"is",
"valid",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L143-L149 | train |
openid/python-openid | openid/association.py | SessionNegotiator.isAllowed | def isAllowed(self, assoc_type, session_type):
"""Is this combination of association type and session type allowed?"""
assoc_good = (assoc_type, session_type) in self.allowed_types
matches = session_type in getSessionTypes(assoc_type)
return assoc_good and matches | python | def isAllowed(self, assoc_type, session_type):
"""Is this combination of association type and session type allowed?"""
assoc_good = (assoc_type, session_type) in self.allowed_types
matches = session_type in getSessionTypes(assoc_type)
return assoc_good and matches | [
"def",
"isAllowed",
"(",
"self",
",",
"assoc_type",
",",
"session_type",
")",
":",
"assoc_good",
"=",
"(",
"assoc_type",
",",
"session_type",
")",
"in",
"self",
".",
"allowed_types",
"matches",
"=",
"session_type",
"in",
"getSessionTypes",
"(",
"assoc_type",
"... | Is this combination of association type and session type allowed? | [
"Is",
"this",
"combination",
"of",
"association",
"type",
"and",
"session",
"type",
"allowed?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L172-L176 | train |
openid/python-openid | openid/association.py | Association.serialize | def serialize(self):
"""
Convert an association to KV form.
@return: String in KV form suitable for deserialization by
deserialize.
@rtype: str
"""
data = {
'version':'2',
'handle':self.handle,
'secret':oidutil.toBase64(se... | python | def serialize(self):
"""
Convert an association to KV form.
@return: String in KV form suitable for deserialization by
deserialize.
@rtype: str
"""
data = {
'version':'2',
'handle':self.handle,
'secret':oidutil.toBase64(se... | [
"def",
"serialize",
"(",
"self",
")",
":",
"data",
"=",
"{",
"'version'",
":",
"'2'",
",",
"'handle'",
":",
"self",
".",
"handle",
",",
"'secret'",
":",
"oidutil",
".",
"toBase64",
"(",
"self",
".",
"secret",
")",
",",
"'issued'",
":",
"str",
"(",
... | Convert an association to KV form.
@return: String in KV form suitable for deserialization by
deserialize.
@rtype: str | [
"Convert",
"an",
"association",
"to",
"KV",
"form",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L398-L421 | train |
openid/python-openid | openid/association.py | Association.getMessageSignature | def getMessageSignature(self, message):
"""Return the signature of a message.
If I am not a sign-all association, the message must have a
signed list.
@return: the signature, base64 encoded
@rtype: str
@raises ValueError: If there is no signed list and I am not a sign... | python | def getMessageSignature(self, message):
"""Return the signature of a message.
If I am not a sign-all association, the message must have a
signed list.
@return: the signature, base64 encoded
@rtype: str
@raises ValueError: If there is no signed list and I am not a sign... | [
"def",
"getMessageSignature",
"(",
"self",
",",
"message",
")",
":",
"pairs",
"=",
"self",
".",
"_makePairs",
"(",
"message",
")",
"return",
"oidutil",
".",
"toBase64",
"(",
"self",
".",
"sign",
"(",
"pairs",
")",
")"
] | Return the signature of a message.
If I am not a sign-all association, the message must have a
signed list.
@return: the signature, base64 encoded
@rtype: str
@raises ValueError: If there is no signed list and I am not a sign-all
type of association. | [
"Return",
"the",
"signature",
"of",
"a",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L482-L496 | train |
openid/python-openid | openid/association.py | Association.checkMessageSignature | def checkMessageSignature(self, message):
"""Given a message with a signature, calculate a new signature
and return whether it matches the signature in the message.
@raises ValueError: if the message has no signature or no signature
can be calculated for it.
"""
mess... | python | def checkMessageSignature(self, message):
"""Given a message with a signature, calculate a new signature
and return whether it matches the signature in the message.
@raises ValueError: if the message has no signature or no signature
can be calculated for it.
"""
mess... | [
"def",
"checkMessageSignature",
"(",
"self",
",",
"message",
")",
":",
"message_sig",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'sig'",
")",
"if",
"not",
"message_sig",
":",
"raise",
"ValueError",
"(",
"\"%s has no sig.\"",
"%",
"(",
"message",
... | Given a message with a signature, calculate a new signature
and return whether it matches the signature in the message.
@raises ValueError: if the message has no signature or no signature
can be calculated for it. | [
"Given",
"a",
"message",
"with",
"a",
"signature",
"calculate",
"a",
"new",
"signature",
"and",
"return",
"whether",
"it",
"matches",
"the",
"signature",
"in",
"the",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L524-L535 | train |
openid/python-openid | openid/extensions/draft/pape2.py | Request.addPolicyURI | def addPolicyURI(self, policy_uri):
"""Add an acceptable authentication policy URI to this request
This method is intended to be used by the relying party to add
acceptable authentication types to the request.
@param policy_uri: The identifier for the preferred type of
auth... | python | def addPolicyURI(self, policy_uri):
"""Add an acceptable authentication policy URI to this request
This method is intended to be used by the relying party to add
acceptable authentication types to the request.
@param policy_uri: The identifier for the preferred type of
auth... | [
"def",
"addPolicyURI",
"(",
"self",
",",
"policy_uri",
")",
":",
"if",
"policy_uri",
"not",
"in",
"self",
".",
"preferred_auth_policies",
":",
"self",
".",
"preferred_auth_policies",
".",
"append",
"(",
"policy_uri",
")"
] | Add an acceptable authentication policy URI to this request
This method is intended to be used by the relying party to add
acceptable authentication types to the request.
@param policy_uri: The identifier for the preferred type of
authentication.
@see: http://openid.net/spe... | [
"Add",
"an",
"acceptable",
"authentication",
"policy",
"URI",
"to",
"this",
"request"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/draft/pape2.py#L60-L71 | train |
openid/python-openid | openid/extensions/draft/pape5.py | PAPEExtension._addAuthLevelAlias | def _addAuthLevelAlias(self, auth_level_uri, alias=None):
"""Add an auth level URI alias to this request.
@param auth_level_uri: The auth level URI to send in the
request.
@param alias: The namespace alias to use for this auth level
in this message. May be None if the a... | python | def _addAuthLevelAlias(self, auth_level_uri, alias=None):
"""Add an auth level URI alias to this request.
@param auth_level_uri: The auth level URI to send in the
request.
@param alias: The namespace alias to use for this auth level
in this message. May be None if the a... | [
"def",
"_addAuthLevelAlias",
"(",
"self",
",",
"auth_level_uri",
",",
"alias",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"try",
":",
"alias",
"=",
"self",
".",
"_getAlias",
"(",
"auth_level_uri",
")",
"except",
"KeyError",
":",
"alias",
"=... | Add an auth level URI alias to this request.
@param auth_level_uri: The auth level URI to send in the
request.
@param alias: The namespace alias to use for this auth level
in this message. May be None if the alias is not
important. | [
"Add",
"an",
"auth",
"level",
"URI",
"alias",
"to",
"this",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/draft/pape5.py#L49-L70 | train |
openid/python-openid | openid/extensions/draft/pape5.py | Response.setAuthLevel | def setAuthLevel(self, level_uri, level, alias=None):
"""Set the value for the given auth level type.
@param level: string representation of an authentication level
valid for level_uri
@param alias: An optional namespace alias for the given auth
level URI. May be omitte... | python | def setAuthLevel(self, level_uri, level, alias=None):
"""Set the value for the given auth level type.
@param level: string representation of an authentication level
valid for level_uri
@param alias: An optional namespace alias for the given auth
level URI. May be omitte... | [
"def",
"setAuthLevel",
"(",
"self",
",",
"level_uri",
",",
"level",
",",
"alias",
"=",
"None",
")",
":",
"self",
".",
"_addAuthLevelAlias",
"(",
"level_uri",
",",
"alias",
")",
"self",
".",
"auth_levels",
"[",
"level_uri",
"]",
"=",
"level"
] | Set the value for the given auth level type.
@param level: string representation of an authentication level
valid for level_uri
@param alias: An optional namespace alias for the given auth
level URI. May be omitted if the alias is not
significant. The library will u... | [
"Set",
"the",
"value",
"for",
"the",
"given",
"auth",
"level",
"type",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/extensions/draft/pape5.py#L298-L310 | train |
openid/python-openid | openid/yadis/discover.py | discover | def discover(uri):
"""Discover services for a given URI.
@param uri: The identity URI as a well-formed http or https
URI. The well-formedness and the protocol are not checked, but
the results of this function are undefined if those properties
do not hold.
@return: DiscoveryResult o... | python | def discover(uri):
"""Discover services for a given URI.
@param uri: The identity URI as a well-formed http or https
URI. The well-formedness and the protocol are not checked, but
the results of this function are undefined if those properties
do not hold.
@return: DiscoveryResult o... | [
"def",
"discover",
"(",
"uri",
")",
":",
"result",
"=",
"DiscoveryResult",
"(",
"uri",
")",
"resp",
"=",
"fetchers",
".",
"fetch",
"(",
"uri",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"YADIS_ACCEPT_HEADER",
"}",
")",
"if",
"resp",
".",
"status",
"not... | Discover services for a given URI.
@param uri: The identity URI as a well-formed http or https
URI. The well-formedness and the protocol are not checked, but
the results of this function are undefined if those properties
do not hold.
@return: DiscoveryResult object
@raises Excepti... | [
"Discover",
"services",
"for",
"a",
"given",
"URI",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/discover.py#L57-L98 | train |
openid/python-openid | openid/yadis/discover.py | whereIsYadis | def whereIsYadis(resp):
"""Given a HTTPResponse, return the location of the Yadis document.
May be the URL just retrieved, another URL, or None, if I can't
find any.
[non-blocking]
@returns: str or None
"""
# Attempt to find out where to go to discover the document
# or if we already ... | python | def whereIsYadis(resp):
"""Given a HTTPResponse, return the location of the Yadis document.
May be the URL just retrieved, another URL, or None, if I can't
find any.
[non-blocking]
@returns: str or None
"""
# Attempt to find out where to go to discover the document
# or if we already ... | [
"def",
"whereIsYadis",
"(",
"resp",
")",
":",
"content_type",
"=",
"resp",
".",
"headers",
".",
"get",
"(",
"'content-type'",
")",
"if",
"(",
"content_type",
"and",
"content_type",
".",
"split",
"(",
"';'",
",",
"1",
")",
"[",
"0",
"]",
".",
"lower",
... | Given a HTTPResponse, return the location of the Yadis document.
May be the URL just retrieved, another URL, or None, if I can't
find any.
[non-blocking]
@returns: str or None | [
"Given",
"a",
"HTTPResponse",
"return",
"the",
"location",
"of",
"the",
"Yadis",
"document",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/discover.py#L102-L154 | train |
openid/python-openid | examples/djopenid/server/views.py | endpoint | def endpoint(request):
"""
Respond to low-level OpenID protocol messages.
"""
s = getServer(request)
query = util.normalDict(request.GET or request.POST)
# First, decode the incoming request into something the OpenID
# library can use.
try:
openid_request = s.decodeRequest(quer... | python | def endpoint(request):
"""
Respond to low-level OpenID protocol messages.
"""
s = getServer(request)
query = util.normalDict(request.GET or request.POST)
# First, decode the incoming request into something the OpenID
# library can use.
try:
openid_request = s.decodeRequest(quer... | [
"def",
"endpoint",
"(",
"request",
")",
":",
"s",
"=",
"getServer",
"(",
"request",
")",
"query",
"=",
"util",
".",
"normalDict",
"(",
"request",
".",
"GET",
"or",
"request",
".",
"POST",
")",
"try",
":",
"openid_request",
"=",
"s",
".",
"decodeRequest... | Respond to low-level OpenID protocol messages. | [
"Respond",
"to",
"low",
"-",
"level",
"OpenID",
"protocol",
"messages",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/djopenid/server/views.py#L101-L136 | train |
openid/python-openid | examples/djopenid/server/views.py | showDecidePage | def showDecidePage(request, openid_request):
"""
Render a page to the user so a trust decision can be made.
@type openid_request: openid.server.server.CheckIDRequest
"""
trust_root = openid_request.trust_root
return_to = openid_request.return_to
try:
# Stringify because template's ... | python | def showDecidePage(request, openid_request):
"""
Render a page to the user so a trust decision can be made.
@type openid_request: openid.server.server.CheckIDRequest
"""
trust_root = openid_request.trust_root
return_to = openid_request.return_to
try:
# Stringify because template's ... | [
"def",
"showDecidePage",
"(",
"request",
",",
"openid_request",
")",
":",
"trust_root",
"=",
"openid_request",
".",
"trust_root",
"return_to",
"=",
"openid_request",
".",
"return_to",
"try",
":",
"trust_root_valid",
"=",
"verifyReturnTo",
"(",
"trust_root",
",",
"... | Render a page to the user so a trust decision can be made.
@type openid_request: openid.server.server.CheckIDRequest | [
"Render",
"a",
"page",
"to",
"the",
"user",
"so",
"a",
"trust",
"decision",
"can",
"be",
"made",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/djopenid/server/views.py#L179-L206 | train |
openid/python-openid | examples/djopenid/server/views.py | processTrustResult | def processTrustResult(request):
"""
Handle the result of a trust decision and respond to the RP
accordingly.
"""
# Get the request from the session so we can construct the
# appropriate response.
openid_request = getRequest(request)
# The identifier that this server can vouch for
r... | python | def processTrustResult(request):
"""
Handle the result of a trust decision and respond to the RP
accordingly.
"""
# Get the request from the session so we can construct the
# appropriate response.
openid_request = getRequest(request)
# The identifier that this server can vouch for
r... | [
"def",
"processTrustResult",
"(",
"request",
")",
":",
"openid_request",
"=",
"getRequest",
"(",
"request",
")",
"response_identity",
"=",
"getViewURL",
"(",
"request",
",",
"idPage",
")",
"allowed",
"=",
"'allow'",
"in",
"request",
".",
"POST",
"openid_response... | Handle the result of a trust decision and respond to the RP
accordingly. | [
"Handle",
"the",
"result",
"of",
"a",
"trust",
"decision",
"and",
"respond",
"to",
"the",
"RP",
"accordingly",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/examples/djopenid/server/views.py#L208-L250 | train |
openid/python-openid | admin/builddiscover.py | buildDiscover | def buildDiscover(base_url, out_dir):
"""Convert all files in a directory to apache mod_asis files in
another directory."""
test_data = discoverdata.readTests(discoverdata.default_test_file)
def writeTestFile(test_name):
template = test_data[test_name]
data = discoverdata.fillTemplate(... | python | def buildDiscover(base_url, out_dir):
"""Convert all files in a directory to apache mod_asis files in
another directory."""
test_data = discoverdata.readTests(discoverdata.default_test_file)
def writeTestFile(test_name):
template = test_data[test_name]
data = discoverdata.fillTemplate(... | [
"def",
"buildDiscover",
"(",
"base_url",
",",
"out_dir",
")",
":",
"test_data",
"=",
"discoverdata",
".",
"readTests",
"(",
"discoverdata",
".",
"default_test_file",
")",
"def",
"writeTestFile",
"(",
"test_name",
")",
":",
"template",
"=",
"test_data",
"[",
"t... | Convert all files in a directory to apache mod_asis files in
another directory. | [
"Convert",
"all",
"files",
"in",
"a",
"directory",
"to",
"apache",
"mod_asis",
"files",
"in",
"another",
"directory",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/admin/builddiscover.py#L31-L63 | train |
openid/python-openid | openid/store/memstore.py | ServerAssocs.best | def best(self):
"""Returns association with the oldest issued date.
or None if there are no associations.
"""
best = None
for assoc in self.assocs.values():
if best is None or best.issued < assoc.issued:
best = assoc
return best | python | def best(self):
"""Returns association with the oldest issued date.
or None if there are no associations.
"""
best = None
for assoc in self.assocs.values():
if best is None or best.issued < assoc.issued:
best = assoc
return best | [
"def",
"best",
"(",
"self",
")",
":",
"best",
"=",
"None",
"for",
"assoc",
"in",
"self",
".",
"assocs",
".",
"values",
"(",
")",
":",
"if",
"best",
"is",
"None",
"or",
"best",
".",
"issued",
"<",
"assoc",
".",
"issued",
":",
"best",
"=",
"assoc",... | Returns association with the oldest issued date.
or None if there are no associations. | [
"Returns",
"association",
"with",
"the",
"oldest",
"issued",
"date",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/memstore.py#L26-L35 | train |
openid/python-openid | openid/store/nonce.py | split | def split(nonce_string):
"""Extract a timestamp from the given nonce string
@param nonce_string: the nonce from which to extract the timestamp
@type nonce_string: str
@returns: A pair of a Unix timestamp and the salt characters
@returntype: (int, str)
@raises ValueError: if the nonce does not... | python | def split(nonce_string):
"""Extract a timestamp from the given nonce string
@param nonce_string: the nonce from which to extract the timestamp
@type nonce_string: str
@returns: A pair of a Unix timestamp and the salt characters
@returntype: (int, str)
@raises ValueError: if the nonce does not... | [
"def",
"split",
"(",
"nonce_string",
")",
":",
"timestamp_str",
"=",
"nonce_string",
"[",
":",
"time_str_len",
"]",
"try",
":",
"timestamp",
"=",
"timegm",
"(",
"strptime",
"(",
"timestamp_str",
",",
"time_fmt",
")",
")",
"except",
"AssertionError",
":",
"ti... | Extract a timestamp from the given nonce string
@param nonce_string: the nonce from which to extract the timestamp
@type nonce_string: str
@returns: A pair of a Unix timestamp and the salt characters
@returntype: (int, str)
@raises ValueError: if the nonce does not start with a correctly
... | [
"Extract",
"a",
"timestamp",
"from",
"the",
"given",
"nonce",
"string"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/nonce.py#L22-L41 | train |
openid/python-openid | openid/store/nonce.py | checkTimestamp | def checkTimestamp(nonce_string, allowed_skew=SKEW, now=None):
"""Is the timestamp that is part of the specified nonce string
within the allowed clock-skew of the current time?
@param nonce_string: The nonce that is being checked
@type nonce_string: str
@param allowed_skew: How many seconds should... | python | def checkTimestamp(nonce_string, allowed_skew=SKEW, now=None):
"""Is the timestamp that is part of the specified nonce string
within the allowed clock-skew of the current time?
@param nonce_string: The nonce that is being checked
@type nonce_string: str
@param allowed_skew: How many seconds should... | [
"def",
"checkTimestamp",
"(",
"nonce_string",
",",
"allowed_skew",
"=",
"SKEW",
",",
"now",
"=",
"None",
")",
":",
"try",
":",
"stamp",
",",
"_",
"=",
"split",
"(",
"nonce_string",
")",
"except",
"ValueError",
":",
"return",
"False",
"else",
":",
"if",
... | Is the timestamp that is part of the specified nonce string
within the allowed clock-skew of the current time?
@param nonce_string: The nonce that is being checked
@type nonce_string: str
@param allowed_skew: How many seconds should be allowed for
completing the request, allowing for clock ske... | [
"Is",
"the",
"timestamp",
"that",
"is",
"part",
"of",
"the",
"specified",
"nonce",
"string",
"within",
"the",
"allowed",
"clock",
"-",
"skew",
"of",
"the",
"current",
"time?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/nonce.py#L43-L77 | train |
openid/python-openid | openid/store/nonce.py | mkNonce | def mkNonce(when=None):
"""Generate a nonce with the current timestamp
@param when: Unix timestamp representing the issue time of the
nonce. Defaults to the current time.
@type when: int
@returntype: str
@returns: A string that should be usable as a one-way nonce
@see: time
"""
... | python | def mkNonce(when=None):
"""Generate a nonce with the current timestamp
@param when: Unix timestamp representing the issue time of the
nonce. Defaults to the current time.
@type when: int
@returntype: str
@returns: A string that should be usable as a one-way nonce
@see: time
"""
... | [
"def",
"mkNonce",
"(",
"when",
"=",
"None",
")",
":",
"salt",
"=",
"cryptutil",
".",
"randomString",
"(",
"6",
",",
"NONCE_CHARS",
")",
"if",
"when",
"is",
"None",
":",
"t",
"=",
"gmtime",
"(",
")",
"else",
":",
"t",
"=",
"gmtime",
"(",
"when",
"... | Generate a nonce with the current timestamp
@param when: Unix timestamp representing the issue time of the
nonce. Defaults to the current time.
@type when: int
@returntype: str
@returns: A string that should be usable as a one-way nonce
@see: time | [
"Generate",
"a",
"nonce",
"with",
"the",
"current",
"timestamp"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/nonce.py#L79-L98 | train |
openid/python-openid | openid/fetchers.py | fetch | def fetch(url, body=None, headers=None):
"""Invoke the fetch method on the default fetcher. Most users
should need only this method.
@raises Exception: any exceptions that may be raised by the default fetcher
"""
fetcher = getDefaultFetcher()
return fetcher.fetch(url, body, headers) | python | def fetch(url, body=None, headers=None):
"""Invoke the fetch method on the default fetcher. Most users
should need only this method.
@raises Exception: any exceptions that may be raised by the default fetcher
"""
fetcher = getDefaultFetcher()
return fetcher.fetch(url, body, headers) | [
"def",
"fetch",
"(",
"url",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"fetcher",
"=",
"getDefaultFetcher",
"(",
")",
"return",
"fetcher",
".",
"fetch",
"(",
"url",
",",
"body",
",",
"headers",
")"
] | Invoke the fetch method on the default fetcher. Most users
should need only this method.
@raises Exception: any exceptions that may be raised by the default fetcher | [
"Invoke",
"the",
"fetch",
"method",
"on",
"the",
"default",
"fetcher",
".",
"Most",
"users",
"should",
"need",
"only",
"this",
"method",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/fetchers.py#L35-L42 | train |
openid/python-openid | openid/fetchers.py | setDefaultFetcher | def setDefaultFetcher(fetcher, wrap_exceptions=True):
"""Set the default fetcher
@param fetcher: The fetcher to use as the default HTTP fetcher
@type fetcher: HTTPFetcher
@param wrap_exceptions: Whether to wrap exceptions thrown by the
fetcher wil HTTPFetchingError so that they may be caught
... | python | def setDefaultFetcher(fetcher, wrap_exceptions=True):
"""Set the default fetcher
@param fetcher: The fetcher to use as the default HTTP fetcher
@type fetcher: HTTPFetcher
@param wrap_exceptions: Whether to wrap exceptions thrown by the
fetcher wil HTTPFetchingError so that they may be caught
... | [
"def",
"setDefaultFetcher",
"(",
"fetcher",
",",
"wrap_exceptions",
"=",
"True",
")",
":",
"global",
"_default_fetcher",
"if",
"fetcher",
"is",
"None",
"or",
"not",
"wrap_exceptions",
":",
"_default_fetcher",
"=",
"fetcher",
"else",
":",
"_default_fetcher",
"=",
... | Set the default fetcher
@param fetcher: The fetcher to use as the default HTTP fetcher
@type fetcher: HTTPFetcher
@param wrap_exceptions: Whether to wrap exceptions thrown by the
fetcher wil HTTPFetchingError so that they may be caught
easier. By default, exceptions will be wrapped. In gen... | [
"Set",
"the",
"default",
"fetcher"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/fetchers.py#L74-L92 | train |
openid/python-openid | openid/fetchers.py | usingCurl | def usingCurl():
"""Whether the currently set HTTP fetcher is a Curl HTTP fetcher."""
fetcher = getDefaultFetcher()
if isinstance(fetcher, ExceptionWrappingFetcher):
fetcher = fetcher.fetcher
return isinstance(fetcher, CurlHTTPFetcher) | python | def usingCurl():
"""Whether the currently set HTTP fetcher is a Curl HTTP fetcher."""
fetcher = getDefaultFetcher()
if isinstance(fetcher, ExceptionWrappingFetcher):
fetcher = fetcher.fetcher
return isinstance(fetcher, CurlHTTPFetcher) | [
"def",
"usingCurl",
"(",
")",
":",
"fetcher",
"=",
"getDefaultFetcher",
"(",
")",
"if",
"isinstance",
"(",
"fetcher",
",",
"ExceptionWrappingFetcher",
")",
":",
"fetcher",
"=",
"fetcher",
".",
"fetcher",
"return",
"isinstance",
"(",
"fetcher",
",",
"CurlHTTPFe... | Whether the currently set HTTP fetcher is a Curl HTTP fetcher. | [
"Whether",
"the",
"currently",
"set",
"HTTP",
"fetcher",
"is",
"a",
"Curl",
"HTTP",
"fetcher",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/fetchers.py#L94-L99 | train |
openid/python-openid | openid/fetchers.py | HTTPLib2Fetcher.fetch | def fetch(self, url, body=None, headers=None):
"""Perform an HTTP request
@raises Exception: Any exception that can be raised by httplib2
@see: C{L{HTTPFetcher.fetch}}
"""
if body:
method = 'POST'
else:
method = 'GET'
if headers is None:... | python | def fetch(self, url, body=None, headers=None):
"""Perform an HTTP request
@raises Exception: Any exception that can be raised by httplib2
@see: C{L{HTTPFetcher.fetch}}
"""
if body:
method = 'POST'
else:
method = 'GET'
if headers is None:... | [
"def",
"fetch",
"(",
"self",
",",
"url",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"if",
"body",
":",
"method",
"=",
"'POST'",
"else",
":",
"method",
"=",
"'GET'",
"if",
"headers",
"is",
"None",
":",
"headers",
"=",
"{",
"}... | Perform an HTTP request
@raises Exception: Any exception that can be raised by httplib2
@see: C{L{HTTPFetcher.fetch}} | [
"Perform",
"an",
"HTTP",
"request"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/fetchers.py#L386-L430 | train |
openid/python-openid | openid/yadis/services.py | getServiceEndpoints | def getServiceEndpoints(input_url, flt=None):
"""Perform the Yadis protocol on the input URL and return an
iterable of resulting endpoint objects.
@param flt: A filter object or something that is convertable to
a filter object (using mkFilter) that will be used to generate
endpoint objects.... | python | def getServiceEndpoints(input_url, flt=None):
"""Perform the Yadis protocol on the input URL and return an
iterable of resulting endpoint objects.
@param flt: A filter object or something that is convertable to
a filter object (using mkFilter) that will be used to generate
endpoint objects.... | [
"def",
"getServiceEndpoints",
"(",
"input_url",
",",
"flt",
"=",
"None",
")",
":",
"result",
"=",
"discover",
"(",
"input_url",
")",
"try",
":",
"endpoints",
"=",
"applyFilter",
"(",
"result",
".",
"normalized_uri",
",",
"result",
".",
"response_text",
",",
... | Perform the Yadis protocol on the input URL and return an
iterable of resulting endpoint objects.
@param flt: A filter object or something that is convertable to
a filter object (using mkFilter) that will be used to generate
endpoint objects. This defaults to generating BasicEndpoint
ob... | [
"Perform",
"the",
"Yadis",
"protocol",
"on",
"the",
"input",
"URL",
"and",
"return",
"an",
"iterable",
"of",
"resulting",
"endpoint",
"objects",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/services.py#L7-L31 | train |
openid/python-openid | openid/yadis/services.py | applyFilter | def applyFilter(normalized_uri, xrd_data, flt=None):
"""Generate an iterable of endpoint objects given this input data,
presumably from the result of performing the Yadis protocol.
@param normalized_uri: The input URL, after following redirects,
as in the Yadis protocol.
@param xrd_data: The ... | python | def applyFilter(normalized_uri, xrd_data, flt=None):
"""Generate an iterable of endpoint objects given this input data,
presumably from the result of performing the Yadis protocol.
@param normalized_uri: The input URL, after following redirects,
as in the Yadis protocol.
@param xrd_data: The ... | [
"def",
"applyFilter",
"(",
"normalized_uri",
",",
"xrd_data",
",",
"flt",
"=",
"None",
")",
":",
"flt",
"=",
"mkFilter",
"(",
"flt",
")",
"et",
"=",
"parseXRDS",
"(",
"xrd_data",
")",
"endpoints",
"=",
"[",
"]",
"for",
"service_element",
"in",
"iterServi... | Generate an iterable of endpoint objects given this input data,
presumably from the result of performing the Yadis protocol.
@param normalized_uri: The input URL, after following redirects,
as in the Yadis protocol.
@param xrd_data: The XML text the XRDS file fetched from the
normalized U... | [
"Generate",
"an",
"iterable",
"of",
"endpoint",
"objects",
"given",
"this",
"input",
"data",
"presumably",
"from",
"the",
"result",
"of",
"performing",
"the",
"Yadis",
"protocol",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/services.py#L33-L54 | train |
openid/python-openid | openid/consumer/html_parse.py | parseLinkAttrs | def parseLinkAttrs(html):
"""Find all link tags in a string representing a HTML document and
return a list of their attributes.
@param html: the text to parse
@type html: str or unicode
@return: A list of dictionaries of attributes, one for each link tag
@rtype: [[(type(html), type(html))]]
... | python | def parseLinkAttrs(html):
"""Find all link tags in a string representing a HTML document and
return a list of their attributes.
@param html: the text to parse
@type html: str or unicode
@return: A list of dictionaries of attributes, one for each link tag
@rtype: [[(type(html), type(html))]]
... | [
"def",
"parseLinkAttrs",
"(",
"html",
")",
":",
"stripped",
"=",
"removed_re",
".",
"sub",
"(",
"''",
",",
"html",
")",
"html_mo",
"=",
"html_find",
".",
"search",
"(",
"stripped",
")",
"if",
"html_mo",
"is",
"None",
"or",
"html_mo",
".",
"start",
"(",... | Find all link tags in a string representing a HTML document and
return a list of their attributes.
@param html: the text to parse
@type html: str or unicode
@return: A list of dictionaries of attributes, one for each link tag
@rtype: [[(type(html), type(html))]] | [
"Find",
"all",
"link",
"tags",
"in",
"a",
"string",
"representing",
"a",
"HTML",
"document",
"and",
"return",
"a",
"list",
"of",
"their",
"attributes",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/html_parse.py#L174-L215 | train |
openid/python-openid | openid/consumer/html_parse.py | relMatches | def relMatches(rel_attr, target_rel):
"""Does this target_rel appear in the rel_str?"""
# XXX: TESTME
rels = rel_attr.strip().split()
for rel in rels:
rel = rel.lower()
if rel == target_rel:
return 1
return 0 | python | def relMatches(rel_attr, target_rel):
"""Does this target_rel appear in the rel_str?"""
# XXX: TESTME
rels = rel_attr.strip().split()
for rel in rels:
rel = rel.lower()
if rel == target_rel:
return 1
return 0 | [
"def",
"relMatches",
"(",
"rel_attr",
",",
"target_rel",
")",
":",
"rels",
"=",
"rel_attr",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"for",
"rel",
"in",
"rels",
":",
"rel",
"=",
"rel",
".",
"lower",
"(",
")",
"if",
"rel",
"==",
"target_rel",... | Does this target_rel appear in the rel_str? | [
"Does",
"this",
"target_rel",
"appear",
"in",
"the",
"rel_str?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/html_parse.py#L217-L226 | train |
openid/python-openid | openid/consumer/html_parse.py | linkHasRel | def linkHasRel(link_attrs, target_rel):
"""Does this link have target_rel as a relationship?"""
# XXX: TESTME
rel_attr = link_attrs.get('rel')
return rel_attr and relMatches(rel_attr, target_rel) | python | def linkHasRel(link_attrs, target_rel):
"""Does this link have target_rel as a relationship?"""
# XXX: TESTME
rel_attr = link_attrs.get('rel')
return rel_attr and relMatches(rel_attr, target_rel) | [
"def",
"linkHasRel",
"(",
"link_attrs",
",",
"target_rel",
")",
":",
"rel_attr",
"=",
"link_attrs",
".",
"get",
"(",
"'rel'",
")",
"return",
"rel_attr",
"and",
"relMatches",
"(",
"rel_attr",
",",
"target_rel",
")"
] | Does this link have target_rel as a relationship? | [
"Does",
"this",
"link",
"have",
"target_rel",
"as",
"a",
"relationship?"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/html_parse.py#L228-L232 | train |
openid/python-openid | openid/consumer/html_parse.py | findFirstHref | def findFirstHref(link_attrs_list, target_rel):
"""Return the value of the href attribute for the first link tag
in the list that has target_rel as a relationship."""
# XXX: TESTME
matches = findLinksRel(link_attrs_list, target_rel)
if not matches:
return None
first = matches[0]
retu... | python | def findFirstHref(link_attrs_list, target_rel):
"""Return the value of the href attribute for the first link tag
in the list that has target_rel as a relationship."""
# XXX: TESTME
matches = findLinksRel(link_attrs_list, target_rel)
if not matches:
return None
first = matches[0]
retu... | [
"def",
"findFirstHref",
"(",
"link_attrs_list",
",",
"target_rel",
")",
":",
"matches",
"=",
"findLinksRel",
"(",
"link_attrs_list",
",",
"target_rel",
")",
"if",
"not",
"matches",
":",
"return",
"None",
"first",
"=",
"matches",
"[",
"0",
"]",
"return",
"fir... | Return the value of the href attribute for the first link tag
in the list that has target_rel as a relationship. | [
"Return",
"the",
"value",
"of",
"the",
"href",
"attribute",
"for",
"the",
"first",
"link",
"tag",
"in",
"the",
"list",
"that",
"has",
"target_rel",
"as",
"a",
"relationship",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/html_parse.py#L241-L249 | train |
openid/python-openid | openid/oidutil.py | importElementTree | def importElementTree(module_names=None):
"""Find a working ElementTree implementation, trying the standard
places that such a thing might show up.
>>> ElementTree = importElementTree()
@param module_names: The names of modules to try to use as
ElementTree. Defaults to C{L{elementtree_modules}... | python | def importElementTree(module_names=None):
"""Find a working ElementTree implementation, trying the standard
places that such a thing might show up.
>>> ElementTree = importElementTree()
@param module_names: The names of modules to try to use as
ElementTree. Defaults to C{L{elementtree_modules}... | [
"def",
"importElementTree",
"(",
"module_names",
"=",
"None",
")",
":",
"if",
"module_names",
"is",
"None",
":",
"module_names",
"=",
"elementtree_modules",
"for",
"mod_name",
"in",
"module_names",
":",
"try",
":",
"ElementTree",
"=",
"__import__",
"(",
"mod_nam... | Find a working ElementTree implementation, trying the standard
places that such a thing might show up.
>>> ElementTree = importElementTree()
@param module_names: The names of modules to try to use as
ElementTree. Defaults to C{L{elementtree_modules}}
@returns: An ElementTree module | [
"Find",
"a",
"working",
"ElementTree",
"implementation",
"trying",
"the",
"standard",
"places",
"that",
"such",
"a",
"thing",
"might",
"show",
"up",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/oidutil.py#L55-L89 | train |
openid/python-openid | openid/yadis/etxrd.py | getYadisXRD | def getYadisXRD(xrd_tree):
"""Return the XRD element that should contain the Yadis services"""
xrd = None
# for the side-effect of assigning the last one in the list to the
# xrd variable
for xrd in xrd_tree.findall(xrd_tag):
pass
# There were no elements found, or else xrd would be se... | python | def getYadisXRD(xrd_tree):
"""Return the XRD element that should contain the Yadis services"""
xrd = None
# for the side-effect of assigning the last one in the list to the
# xrd variable
for xrd in xrd_tree.findall(xrd_tag):
pass
# There were no elements found, or else xrd would be se... | [
"def",
"getYadisXRD",
"(",
"xrd_tree",
")",
":",
"xrd",
"=",
"None",
"for",
"xrd",
"in",
"xrd_tree",
".",
"findall",
"(",
"xrd_tag",
")",
":",
"pass",
"if",
"xrd",
"is",
"None",
":",
"raise",
"XRDSError",
"(",
"'No XRD present in tree'",
")",
"return",
"... | Return the XRD element that should contain the Yadis services | [
"Return",
"the",
"XRD",
"element",
"that",
"should",
"contain",
"the",
"Yadis",
"services"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/etxrd.py#L119-L133 | train |
openid/python-openid | openid/yadis/etxrd.py | getXRDExpiration | def getXRDExpiration(xrd_element, default=None):
"""Return the expiration date of this XRD element, or None if no
expiration was specified.
@type xrd_element: ElementTree node
@param default: The value to use as the expiration if no
expiration was specified in the XRD.
@rtype: datetime.da... | python | def getXRDExpiration(xrd_element, default=None):
"""Return the expiration date of this XRD element, or None if no
expiration was specified.
@type xrd_element: ElementTree node
@param default: The value to use as the expiration if no
expiration was specified in the XRD.
@rtype: datetime.da... | [
"def",
"getXRDExpiration",
"(",
"xrd_element",
",",
"default",
"=",
"None",
")",
":",
"expires_element",
"=",
"xrd_element",
".",
"find",
"(",
"expires_tag",
")",
"if",
"expires_element",
"is",
"None",
":",
"return",
"default",
"else",
":",
"expires_string",
"... | Return the expiration date of this XRD element, or None if no
expiration was specified.
@type xrd_element: ElementTree node
@param default: The value to use as the expiration if no
expiration was specified in the XRD.
@rtype: datetime.datetime
@raises ValueError: If the xrd:Expires eleme... | [
"Return",
"the",
"expiration",
"date",
"of",
"this",
"XRD",
"element",
"or",
"None",
"if",
"no",
"expiration",
"was",
"specified",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/etxrd.py#L135-L157 | train |
openid/python-openid | openid/yadis/etxrd.py | getCanonicalID | def getCanonicalID(iname, xrd_tree):
"""Return the CanonicalID from this XRDS document.
@param iname: the XRI being resolved.
@type iname: unicode
@param xrd_tree: The XRDS output from the resolver.
@type xrd_tree: ElementTree
@returns: The XRI CanonicalID or None.
@returntype: unicode or... | python | def getCanonicalID(iname, xrd_tree):
"""Return the CanonicalID from this XRDS document.
@param iname: the XRI being resolved.
@type iname: unicode
@param xrd_tree: The XRDS output from the resolver.
@type xrd_tree: ElementTree
@returns: The XRI CanonicalID or None.
@returntype: unicode or... | [
"def",
"getCanonicalID",
"(",
"iname",
",",
"xrd_tree",
")",
":",
"xrd_list",
"=",
"xrd_tree",
".",
"findall",
"(",
"xrd_tag",
")",
"xrd_list",
".",
"reverse",
"(",
")",
"try",
":",
"canonicalID",
"=",
"xri",
".",
"XRI",
"(",
"xrd_list",
"[",
"0",
"]",... | Return the CanonicalID from this XRDS document.
@param iname: the XRI being resolved.
@type iname: unicode
@param xrd_tree: The XRDS output from the resolver.
@type xrd_tree: ElementTree
@returns: The XRI CanonicalID or None.
@returntype: unicode or None | [
"Return",
"the",
"CanonicalID",
"from",
"this",
"XRDS",
"document",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/etxrd.py#L159-L194 | train |
openid/python-openid | openid/yadis/etxrd.py | getPriorityStrict | def getPriorityStrict(element):
"""Get the priority of this element.
Raises ValueError if the value of the priority is invalid. If no
priority is specified, it returns a value that compares greater
than any other value.
"""
prio_str = element.get('priority')
if prio_str is not None:
... | python | def getPriorityStrict(element):
"""Get the priority of this element.
Raises ValueError if the value of the priority is invalid. If no
priority is specified, it returns a value that compares greater
than any other value.
"""
prio_str = element.get('priority')
if prio_str is not None:
... | [
"def",
"getPriorityStrict",
"(",
"element",
")",
":",
"prio_str",
"=",
"element",
".",
"get",
"(",
"'priority'",
")",
"if",
"prio_str",
"is",
"not",
"None",
":",
"prio_val",
"=",
"int",
"(",
"prio_str",
")",
"if",
"prio_val",
">=",
"0",
":",
"return",
... | Get the priority of this element.
Raises ValueError if the value of the priority is invalid. If no
priority is specified, it returns a value that compares greater
than any other value. | [
"Get",
"the",
"priority",
"of",
"this",
"element",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/yadis/etxrd.py#L211-L227 | train |
openid/python-openid | openid/consumer/consumer.py | makeKVPost | def makeKVPost(request_message, server_url):
"""Make a Direct Request to an OpenID Provider and return the
result as a Message object.
@raises openid.fetchers.HTTPFetchingError: if an error is
encountered in making the HTTP post.
@rtype: L{openid.message.Message}
"""
# XXX: TESTME
... | python | def makeKVPost(request_message, server_url):
"""Make a Direct Request to an OpenID Provider and return the
result as a Message object.
@raises openid.fetchers.HTTPFetchingError: if an error is
encountered in making the HTTP post.
@rtype: L{openid.message.Message}
"""
# XXX: TESTME
... | [
"def",
"makeKVPost",
"(",
"request_message",
",",
"server_url",
")",
":",
"resp",
"=",
"fetchers",
".",
"fetch",
"(",
"server_url",
",",
"body",
"=",
"request_message",
".",
"toURLEncoded",
"(",
")",
")",
"return",
"_httpResponseToMessage",
"(",
"resp",
",",
... | Make a Direct Request to an OpenID Provider and return the
result as a Message object.
@raises openid.fetchers.HTTPFetchingError: if an error is
encountered in making the HTTP post.
@rtype: L{openid.message.Message} | [
"Make",
"a",
"Direct",
"Request",
"to",
"an",
"OpenID",
"Provider",
"and",
"return",
"the",
"result",
"as",
"a",
"Message",
"object",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L217-L230 | train |
openid/python-openid | openid/consumer/consumer.py | _httpResponseToMessage | def _httpResponseToMessage(response, server_url):
"""Adapt a POST response to a Message.
@type response: L{openid.fetchers.HTTPResponse}
@param response: Result of a POST to an OpenID endpoint.
@rtype: L{openid.message.Message}
@raises openid.fetchers.HTTPFetchingError: if the server returned a
... | python | def _httpResponseToMessage(response, server_url):
"""Adapt a POST response to a Message.
@type response: L{openid.fetchers.HTTPResponse}
@param response: Result of a POST to an OpenID endpoint.
@rtype: L{openid.message.Message}
@raises openid.fetchers.HTTPFetchingError: if the server returned a
... | [
"def",
"_httpResponseToMessage",
"(",
"response",
",",
"server_url",
")",
":",
"response_message",
"=",
"Message",
".",
"fromKVForm",
"(",
"response",
".",
"body",
")",
"if",
"response",
".",
"status",
"==",
"400",
":",
"raise",
"ServerError",
".",
"fromMessag... | Adapt a POST response to a Message.
@type response: L{openid.fetchers.HTTPResponse}
@param response: Result of a POST to an OpenID endpoint.
@rtype: L{openid.message.Message}
@raises openid.fetchers.HTTPFetchingError: if the server returned a
status of other than 200 or 400.
@raises Serv... | [
"Adapt",
"a",
"POST",
"response",
"to",
"a",
"Message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L233-L256 | train |
openid/python-openid | openid/consumer/consumer.py | Consumer.complete | def complete(self, query, current_url):
"""Called to interpret the server's response to an OpenID
request. It is called in step 4 of the flow described in the
consumer overview.
@param query: A dictionary of the query parameters for this
HTTP request.
@param current... | python | def complete(self, query, current_url):
"""Called to interpret the server's response to an OpenID
request. It is called in step 4 of the flow described in the
consumer overview.
@param query: A dictionary of the query parameters for this
HTTP request.
@param current... | [
"def",
"complete",
"(",
"self",
",",
"query",
",",
"current_url",
")",
":",
"endpoint",
"=",
"self",
".",
"session",
".",
"get",
"(",
"self",
".",
"_token_key",
")",
"message",
"=",
"Message",
".",
"fromPostArgs",
"(",
"query",
")",
"response",
"=",
"s... | Called to interpret the server's response to an OpenID
request. It is called in step 4 of the flow described in the
consumer overview.
@param query: A dictionary of the query parameters for this
HTTP request.
@param current_url: The URL used to invoke the application.
... | [
"Called",
"to",
"interpret",
"the",
"server",
"s",
"response",
"to",
"an",
"OpenID",
"request",
".",
"It",
"is",
"called",
"in",
"step",
"4",
"of",
"the",
"flow",
"described",
"in",
"the",
"consumer",
"overview",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L387-L432 | train |
openid/python-openid | openid/consumer/consumer.py | ServerError.fromMessage | def fromMessage(cls, message):
"""Generate a ServerError instance, extracting the error text
and the error code from the message."""
error_text = message.getArg(
OPENID_NS, 'error', '<no error message supplied>')
error_code = message.getArg(OPENID_NS, 'error_code')
re... | python | def fromMessage(cls, message):
"""Generate a ServerError instance, extracting the error text
and the error code from the message."""
error_text = message.getArg(
OPENID_NS, 'error', '<no error message supplied>')
error_code = message.getArg(OPENID_NS, 'error_code')
re... | [
"def",
"fromMessage",
"(",
"cls",
",",
"message",
")",
":",
"error_text",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'error'",
",",
"'<no error message supplied>'",
")",
"error_code",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'error_co... | Generate a ServerError instance, extracting the error text
and the error code from the message. | [
"Generate",
"a",
"ServerError",
"instance",
"extracting",
"the",
"error",
"text",
"and",
"the",
"error",
"code",
"from",
"the",
"message",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L544-L550 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer.begin | def begin(self, service_endpoint):
"""Create an AuthRequest object for the specified
service_endpoint. This method will create an association if
necessary."""
if self.store is None:
assoc = None
else:
assoc = self._getAssociation(service_endpoint)
... | python | def begin(self, service_endpoint):
"""Create an AuthRequest object for the specified
service_endpoint. This method will create an association if
necessary."""
if self.store is None:
assoc = None
else:
assoc = self._getAssociation(service_endpoint)
... | [
"def",
"begin",
"(",
"self",
",",
"service_endpoint",
")",
":",
"if",
"self",
".",
"store",
"is",
"None",
":",
"assoc",
"=",
"None",
"else",
":",
"assoc",
"=",
"self",
".",
"_getAssociation",
"(",
"service_endpoint",
")",
"request",
"=",
"AuthRequest",
"... | Create an AuthRequest object for the specified
service_endpoint. This method will create an association if
necessary. | [
"Create",
"an",
"AuthRequest",
"object",
"for",
"the",
"specified",
"service_endpoint",
".",
"This",
"method",
"will",
"create",
"an",
"association",
"if",
"necessary",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L592-L608 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer.complete | def complete(self, message, endpoint, return_to):
"""Process the OpenID message, using the specified endpoint
and return_to URL as context. This method will handle any
OpenID message that is sent to the return_to URL.
"""
mode = message.getArg(OPENID_NS, 'mode', '<No mode set>')
... | python | def complete(self, message, endpoint, return_to):
"""Process the OpenID message, using the specified endpoint
and return_to URL as context. This method will handle any
OpenID message that is sent to the return_to URL.
"""
mode = message.getArg(OPENID_NS, 'mode', '<No mode set>')
... | [
"def",
"complete",
"(",
"self",
",",
"message",
",",
"endpoint",
",",
"return_to",
")",
":",
"mode",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'mode'",
",",
"'<No mode set>'",
")",
"modeMethod",
"=",
"getattr",
"(",
"self",
",",
"'_complete_'"... | Process the OpenID message, using the specified endpoint
and return_to URL as context. This method will handle any
OpenID message that is sent to the return_to URL. | [
"Process",
"the",
"OpenID",
"message",
"using",
"the",
"specified",
"endpoint",
"and",
"return_to",
"URL",
"as",
"context",
".",
"This",
"method",
"will",
"handle",
"any",
"OpenID",
"message",
"that",
"is",
"sent",
"to",
"the",
"return_to",
"URL",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L610-L620 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._checkSetupNeeded | def _checkSetupNeeded(self, message):
"""Check an id_res message to see if it is a
checkid_immediate cancel response.
@raises SetupNeededError: if it is a checkid_immediate cancellation
"""
# In OpenID 1, we check to see if this is a cancel from
# immediate mode by the p... | python | def _checkSetupNeeded(self, message):
"""Check an id_res message to see if it is a
checkid_immediate cancel response.
@raises SetupNeededError: if it is a checkid_immediate cancellation
"""
# In OpenID 1, we check to see if this is a cancel from
# immediate mode by the p... | [
"def",
"_checkSetupNeeded",
"(",
"self",
",",
"message",
")",
":",
"if",
"message",
".",
"isOpenID1",
"(",
")",
":",
"user_setup_url",
"=",
"message",
".",
"getArg",
"(",
"OPENID1_NS",
",",
"'user_setup_url'",
")",
"if",
"user_setup_url",
"is",
"not",
"None"... | Check an id_res message to see if it is a
checkid_immediate cancel response.
@raises SetupNeededError: if it is a checkid_immediate cancellation | [
"Check",
"an",
"id_res",
"message",
"to",
"see",
"if",
"it",
"is",
"a",
"checkid_immediate",
"cancel",
"response",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L687-L699 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._doIdRes | def _doIdRes(self, message, endpoint, return_to):
"""Handle id_res responses that are not cancellations of
immediate mode requests.
@param message: the response paramaters.
@param endpoint: the discovered endpoint object. May be None.
@raises ProtocolError: If the message conte... | python | def _doIdRes(self, message, endpoint, return_to):
"""Handle id_res responses that are not cancellations of
immediate mode requests.
@param message: the response paramaters.
@param endpoint: the discovered endpoint object. May be None.
@raises ProtocolError: If the message conte... | [
"def",
"_doIdRes",
"(",
"self",
",",
"message",
",",
"endpoint",
",",
"return_to",
")",
":",
"self",
".",
"_idResCheckForFields",
"(",
"message",
")",
"if",
"not",
"self",
".",
"_checkReturnTo",
"(",
"message",
",",
"return_to",
")",
":",
"raise",
"Protoco... | Handle id_res responses that are not cancellations of
immediate mode requests.
@param message: the response paramaters.
@param endpoint: the discovered endpoint object. May be None.
@raises ProtocolError: If the message contents are not
well-formed according to the OpenID s... | [
"Handle",
"id_res",
"responses",
"that",
"are",
"not",
"cancellations",
"of",
"immediate",
"mode",
"requests",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L701-L744 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._verifyReturnToArgs | def _verifyReturnToArgs(query):
"""Verify that the arguments in the return_to URL are present in this
response.
"""
message = Message.fromPostArgs(query)
return_to = message.getArg(OPENID_NS, 'return_to')
if return_to is None:
raise ProtocolError('Response ha... | python | def _verifyReturnToArgs(query):
"""Verify that the arguments in the return_to URL are present in this
response.
"""
message = Message.fromPostArgs(query)
return_to = message.getArg(OPENID_NS, 'return_to')
if return_to is None:
raise ProtocolError('Response ha... | [
"def",
"_verifyReturnToArgs",
"(",
"query",
")",
":",
"message",
"=",
"Message",
".",
"fromPostArgs",
"(",
"query",
")",
"return_to",
"=",
"message",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'return_to'",
")",
"if",
"return_to",
"is",
"None",
":",
"raise",
"... | Verify that the arguments in the return_to URL are present in this
response. | [
"Verify",
"that",
"the",
"arguments",
"in",
"the",
"return_to",
"URL",
"are",
"present",
"in",
"this",
"response",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L843-L873 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._verifyDiscoveryResults | def _verifyDiscoveryResults(self, resp_msg, endpoint=None):
"""
Extract the information from an OpenID assertion message and
verify it against the original
@param endpoint: The endpoint that resulted from doing discovery
@param resp_msg: The id_res message object
@retur... | python | def _verifyDiscoveryResults(self, resp_msg, endpoint=None):
"""
Extract the information from an OpenID assertion message and
verify it against the original
@param endpoint: The endpoint that resulted from doing discovery
@param resp_msg: The id_res message object
@retur... | [
"def",
"_verifyDiscoveryResults",
"(",
"self",
",",
"resp_msg",
",",
"endpoint",
"=",
"None",
")",
":",
"if",
"resp_msg",
".",
"getOpenIDNamespace",
"(",
")",
"==",
"OPENID2_NS",
":",
"return",
"self",
".",
"_verifyDiscoveryResultsOpenID2",
"(",
"resp_msg",
",",... | Extract the information from an OpenID assertion message and
verify it against the original
@param endpoint: The endpoint that resulted from doing discovery
@param resp_msg: The id_res message object
@returns: the verified endpoint | [
"Extract",
"the",
"information",
"from",
"an",
"OpenID",
"assertion",
"message",
"and",
"verify",
"it",
"against",
"the",
"original"
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L877-L890 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._verifyDiscoverySingle | def _verifyDiscoverySingle(self, endpoint, to_match):
"""Verify that the given endpoint matches the information
extracted from the OpenID assertion, and raise an exception if
there is a mismatch.
@type endpoint: openid.consumer.discover.OpenIDServiceEndpoint
@type to_match: open... | python | def _verifyDiscoverySingle(self, endpoint, to_match):
"""Verify that the given endpoint matches the information
extracted from the OpenID assertion, and raise an exception if
there is a mismatch.
@type endpoint: openid.consumer.discover.OpenIDServiceEndpoint
@type to_match: open... | [
"def",
"_verifyDiscoverySingle",
"(",
"self",
",",
"endpoint",
",",
"to_match",
")",
":",
"for",
"type_uri",
"in",
"to_match",
".",
"type_uris",
":",
"if",
"not",
"endpoint",
".",
"usesExtension",
"(",
"type_uri",
")",
":",
"raise",
"TypeURIMismatch",
"(",
"... | Verify that the given endpoint matches the information
extracted from the OpenID assertion, and raise an exception if
there is a mismatch.
@type endpoint: openid.consumer.discover.OpenIDServiceEndpoint
@type to_match: openid.consumer.discover.OpenIDServiceEndpoint
@rtype: NoneT... | [
"Verify",
"that",
"the",
"given",
"endpoint",
"matches",
"the",
"information",
"extracted",
"from",
"the",
"OpenID",
"assertion",
"and",
"raise",
"an",
"exception",
"if",
"there",
"is",
"a",
"mismatch",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L989-L1035 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._discoverAndVerify | def _discoverAndVerify(self, claimed_id, to_match_endpoints):
"""Given an endpoint object created from the information in an
OpenID response, perform discovery and verify the discovery
results, returning the matching endpoint that is the result of
doing that discovery.
@type to_... | python | def _discoverAndVerify(self, claimed_id, to_match_endpoints):
"""Given an endpoint object created from the information in an
OpenID response, perform discovery and verify the discovery
results, returning the matching endpoint that is the result of
doing that discovery.
@type to_... | [
"def",
"_discoverAndVerify",
"(",
"self",
",",
"claimed_id",
",",
"to_match_endpoints",
")",
":",
"logging",
".",
"info",
"(",
"'Performing discovery on %s'",
"%",
"(",
"claimed_id",
",",
")",
")",
"_",
",",
"services",
"=",
"self",
".",
"_discover",
"(",
"c... | Given an endpoint object created from the information in an
OpenID response, perform discovery and verify the discovery
results, returning the matching endpoint that is the result of
doing that discovery.
@type to_match: openid.consumer.discover.OpenIDServiceEndpoint
@param to_m... | [
"Given",
"an",
"endpoint",
"object",
"created",
"from",
"the",
"information",
"in",
"an",
"OpenID",
"response",
"perform",
"discovery",
"and",
"verify",
"the",
"discovery",
"results",
"returning",
"the",
"matching",
"endpoint",
"that",
"is",
"the",
"result",
"of... | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1037-L1058 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._processCheckAuthResponse | def _processCheckAuthResponse(self, response, server_url):
"""Process the response message from a check_authentication
request, invalidating associations if requested.
"""
is_valid = response.getArg(OPENID_NS, 'is_valid', 'false')
invalidate_handle = response.getArg(OPENID_NS, '... | python | def _processCheckAuthResponse(self, response, server_url):
"""Process the response message from a check_authentication
request, invalidating associations if requested.
"""
is_valid = response.getArg(OPENID_NS, 'is_valid', 'false')
invalidate_handle = response.getArg(OPENID_NS, '... | [
"def",
"_processCheckAuthResponse",
"(",
"self",
",",
"response",
",",
"server_url",
")",
":",
"is_valid",
"=",
"response",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'is_valid'",
",",
"'false'",
")",
"invalidate_handle",
"=",
"response",
".",
"getArg",
"(",
"OPEN... | Process the response message from a check_authentication
request, invalidating associations if requested. | [
"Process",
"the",
"response",
"message",
"from",
"a",
"check_authentication",
"request",
"invalidating",
"associations",
"if",
"requested",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1125-L1145 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._getAssociation | def _getAssociation(self, endpoint):
"""Get an association for the endpoint's server_url.
First try seeing if we have a good association in the
store. If we do not, then attempt to negotiate an association
with the server.
If we negotiate a good association, it will get stored.... | python | def _getAssociation(self, endpoint):
"""Get an association for the endpoint's server_url.
First try seeing if we have a good association in the
store. If we do not, then attempt to negotiate an association
with the server.
If we negotiate a good association, it will get stored.... | [
"def",
"_getAssociation",
"(",
"self",
",",
"endpoint",
")",
":",
"assoc",
"=",
"self",
".",
"store",
".",
"getAssociation",
"(",
"endpoint",
".",
"server_url",
")",
"if",
"assoc",
"is",
"None",
"or",
"assoc",
".",
"expiresIn",
"<=",
"0",
":",
"assoc",
... | Get an association for the endpoint's server_url.
First try seeing if we have a good association in the
store. If we do not, then attempt to negotiate an association
with the server.
If we negotiate a good association, it will get stored.
@returns: A valid association for the ... | [
"Get",
"an",
"association",
"for",
"the",
"endpoint",
"s",
"server_url",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1147-L1166 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._extractSupportedAssociationType | def _extractSupportedAssociationType(self, server_error, endpoint,
assoc_type):
"""Handle ServerErrors resulting from association requests.
@returns: If server replied with an C{unsupported-type} error,
return a tuple of supported C{association_type}... | python | def _extractSupportedAssociationType(self, server_error, endpoint,
assoc_type):
"""Handle ServerErrors resulting from association requests.
@returns: If server replied with an C{unsupported-type} error,
return a tuple of supported C{association_type}... | [
"def",
"_extractSupportedAssociationType",
"(",
"self",
",",
"server_error",
",",
"endpoint",
",",
"assoc_type",
")",
":",
"if",
"server_error",
".",
"error_code",
"!=",
"'unsupported-type'",
"or",
"server_error",
".",
"message",
".",
"isOpenID1",
"(",
")",
":",
... | Handle ServerErrors resulting from association requests.
@returns: If server replied with an C{unsupported-type} error,
return a tuple of supported C{association_type}, C{session_type}.
Otherwise logs the error and returns None.
@rtype: tuple or None | [
"Handle",
"ServerErrors",
"resulting",
"from",
"association",
"requests",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1207-L1247 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._requestAssociation | def _requestAssociation(self, endpoint, assoc_type, session_type):
"""Make and process one association request to this endpoint's
OP endpoint URL.
@returns: An association object or None if the association
processing failed.
@raises ServerError: when the remote OpenID serve... | python | def _requestAssociation(self, endpoint, assoc_type, session_type):
"""Make and process one association request to this endpoint's
OP endpoint URL.
@returns: An association object or None if the association
processing failed.
@raises ServerError: when the remote OpenID serve... | [
"def",
"_requestAssociation",
"(",
"self",
",",
"endpoint",
",",
"assoc_type",
",",
"session_type",
")",
":",
"assoc_session",
",",
"args",
"=",
"self",
".",
"_createAssociateRequest",
"(",
"endpoint",
",",
"assoc_type",
",",
"session_type",
")",
"try",
":",
"... | Make and process one association request to this endpoint's
OP endpoint URL.
@returns: An association object or None if the association
processing failed.
@raises ServerError: when the remote OpenID server returns an error. | [
"Make",
"and",
"process",
"one",
"association",
"request",
"to",
"this",
"endpoint",
"s",
"OP",
"endpoint",
"URL",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1250-L1279 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._createAssociateRequest | def _createAssociateRequest(self, endpoint, assoc_type, session_type):
"""Create an association request for the given assoc_type and
session_type.
@param endpoint: The endpoint whose server_url will be
queried. The important bit about the endpoint is whether
it's in comp... | python | def _createAssociateRequest(self, endpoint, assoc_type, session_type):
"""Create an association request for the given assoc_type and
session_type.
@param endpoint: The endpoint whose server_url will be
queried. The important bit about the endpoint is whether
it's in comp... | [
"def",
"_createAssociateRequest",
"(",
"self",
",",
"endpoint",
",",
"assoc_type",
",",
"session_type",
")",
":",
"session_type_class",
"=",
"self",
".",
"session_types",
"[",
"session_type",
"]",
"assoc_session",
"=",
"session_type_class",
"(",
")",
"args",
"=",
... | Create an association request for the given assoc_type and
session_type.
@param endpoint: The endpoint whose server_url will be
queried. The important bit about the endpoint is whether
it's in compatiblity mode (OpenID 1.1)
@param assoc_type: The association type that t... | [
"Create",
"an",
"association",
"request",
"for",
"the",
"given",
"assoc_type",
"and",
"session_type",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1281-L1324 | train |
openid/python-openid | openid/consumer/consumer.py | GenericConsumer._extractAssociation | def _extractAssociation(self, assoc_response, assoc_session):
"""Attempt to extract an association from the response, given
the association response message and the established
association session.
@param assoc_response: The association response message from
the server
... | python | def _extractAssociation(self, assoc_response, assoc_session):
"""Attempt to extract an association from the response, given
the association response message and the established
association session.
@param assoc_response: The association response message from
the server
... | [
"def",
"_extractAssociation",
"(",
"self",
",",
"assoc_response",
",",
"assoc_session",
")",
":",
"assoc_type",
"=",
"assoc_response",
".",
"getArg",
"(",
"OPENID_NS",
",",
"'assoc_type'",
",",
"no_default",
")",
"assoc_handle",
"=",
"assoc_response",
".",
"getArg... | Attempt to extract an association from the response, given
the association response message and the established
association session.
@param assoc_response: The association response message from
the server
@type assoc_response: openid.message.Message
@param assoc_ses... | [
"Attempt",
"to",
"extract",
"an",
"association",
"from",
"the",
"response",
"given",
"the",
"association",
"response",
"message",
"and",
"the",
"established",
"association",
"session",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1364-L1440 | train |
openid/python-openid | openid/consumer/consumer.py | AuthRequest.setAnonymous | def setAnonymous(self, is_anonymous):
"""Set whether this request should be made anonymously. If a
request is anonymous, the identifier will not be sent in the
request. This is only useful if you are making another kind of
request with an extension in this request.
Anonymous req... | python | def setAnonymous(self, is_anonymous):
"""Set whether this request should be made anonymously. If a
request is anonymous, the identifier will not be sent in the
request. This is only useful if you are making another kind of
request with an extension in this request.
Anonymous req... | [
"def",
"setAnonymous",
"(",
"self",
",",
"is_anonymous",
")",
":",
"if",
"is_anonymous",
"and",
"self",
".",
"message",
".",
"isOpenID1",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'OpenID 1 requests MUST include the '",
"'identifier in the request'",
")",
"else",
... | Set whether this request should be made anonymously. If a
request is anonymous, the identifier will not be sent in the
request. This is only useful if you are making another kind of
request with an extension in this request.
Anonymous requests are not allowed when the request is made
... | [
"Set",
"whether",
"this",
"request",
"should",
"be",
"made",
"anonymously",
".",
"If",
"a",
"request",
"is",
"anonymous",
"the",
"identifier",
"will",
"not",
"be",
"sent",
"in",
"the",
"request",
".",
"This",
"is",
"only",
"useful",
"if",
"you",
"are",
"... | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1469-L1485 | train |
openid/python-openid | openid/consumer/consumer.py | AuthRequest.addExtensionArg | def addExtensionArg(self, namespace, key, value):
"""Add an extension argument to this OpenID authentication
request.
Use caution when adding arguments, because they will be
URL-escaped and appended to the redirect URL, which can easily
get quite long.
@param namespace:... | python | def addExtensionArg(self, namespace, key, value):
"""Add an extension argument to this OpenID authentication
request.
Use caution when adding arguments, because they will be
URL-escaped and appended to the redirect URL, which can easily
get quite long.
@param namespace:... | [
"def",
"addExtensionArg",
"(",
"self",
",",
"namespace",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"message",
".",
"setArg",
"(",
"namespace",
",",
"key",
",",
"value",
")"
] | Add an extension argument to this OpenID authentication
request.
Use caution when adding arguments, because they will be
URL-escaped and appended to the redirect URL, which can easily
get quite long.
@param namespace: The namespace for the extension. For
example, th... | [
"Add",
"an",
"extension",
"argument",
"to",
"this",
"OpenID",
"authentication",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1496-L1521 | train |
openid/python-openid | openid/consumer/consumer.py | AuthRequest.redirectURL | def redirectURL(self, realm, return_to=None, immediate=False):
"""Returns a URL with an encoded OpenID request.
The resulting URL is the OpenID provider's endpoint URL with
parameters appended as query arguments. You should redirect
the user agent to this URL.
OpenID 2.0 endpo... | python | def redirectURL(self, realm, return_to=None, immediate=False):
"""Returns a URL with an encoded OpenID request.
The resulting URL is the OpenID provider's endpoint URL with
parameters appended as query arguments. You should redirect
the user agent to this URL.
OpenID 2.0 endpo... | [
"def",
"redirectURL",
"(",
"self",
",",
"realm",
",",
"return_to",
"=",
"None",
",",
"immediate",
"=",
"False",
")",
":",
"message",
"=",
"self",
".",
"getMessage",
"(",
"realm",
",",
"return_to",
",",
"immediate",
")",
"return",
"message",
".",
"toURL",... | Returns a URL with an encoded OpenID request.
The resulting URL is the OpenID provider's endpoint URL with
parameters appended as query arguments. You should redirect
the user agent to this URL.
OpenID 2.0 endpoints also accept POST requests, see
C{L{shouldSendRedirect}} and C... | [
"Returns",
"a",
"URL",
"with",
"an",
"encoded",
"OpenID",
"request",
"."
] | f7e13536f0d1828d3cef5ae7a7b55cabadff37fc | https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L1608-L1647 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.