Package openid :: Package server :: Module server :: Class OpenIDResponse
[frames] | no frames]

Class OpenIDResponse

source code

object --+
         |
        OpenIDResponse

I am a response to an OpenID request.

Instance Methods [hide private]
  __init__(self, request)
Make a response to an OpenIDRequest.
  addField(self, namespace, key, value, signed=True)
Add a field to this response.
  addFields(self, namespace, fields, signed=True)
Add a number of fields to this response.
  update(self, namespace, other)
Update my fields with those from another OpenIDResponse.
bool needsSigning(self)
Does this response require signing?
  whichEncoding(self)
How should I be encoded?
str encodeToURL(self)
Encode a response as a URL for the user agent to GET.
str encodeToKVForm(self)
Encode a response in key-value colon/newline format.
  __str__(self)
str(x)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__


Instance Variables [hide private]
dict fields
My parameters as a dictionary with each key mapping to one value.
OpenIDRequest request
The request I respond to.
list of str signed
The names of the fields which should be signed.

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, request)
(Constructor)

source code 

Make a response to an OpenIDRequest.
Overrides: object.__init__

addField(self, namespace, key, value, signed=True)

source code 

Add a field to this response.
Parameters:
  • namespace (str) - The extension namespace the field is in, with no leading "openid." e.g. "sreg".
  • key (str) - The field's name, e.g. "fullname".
  • value (str) - The field's value.
  • signed (bool) - Whether this field should be signed.

addFields(self, namespace, fields, signed=True)

source code 

Add a number of fields to this response.
Parameters:
  • namespace (str) - The extension namespace the field is in, with no leading "openid." e.g. "sreg".
  • fields - A dictionary with the fields to add. e.g. {"fullname": "Frank the Goat"}
  • signed (bool) - Whether these fields should be signed.

update(self, namespace, other)

source code 

Update my fields with those from another OpenIDResponse.

The idea here is that if you write an OpenID extension, it could produce a Response object with fields and signed attributes, and you could merge it with me using this method before I am signed and sent.

All entries in other.fields will have their keys prefixed with namespace and added to my fields. All elements of other.signed will be prefixed with namespace and added to my signed list.
Parameters:
  • namespace (str) - The extension namespace the field is in, with no leading "openid." e.g. "sreg".
  • other (OpenIDResponse) - A response object to update from.

needsSigning(self)

source code 

Does this response require signing?
Returns: bool

whichEncoding(self)

source code 

How should I be encoded?
Returns:
one of ENCODE_URL or ENCODE_KVFORM.

encodeToURL(self)

source code 

Encode a response as a URL for the user agent to GET.

You will generally use this URL with a HTTP redirect.
Returns: str
A URL to direct the user agent back to.

encodeToKVForm(self)

source code 

Encode a response in key-value colon/newline format.

This is a machine-readable format used to respond to messages which came directly from the consumer and not through the user agent.
Returns: str

See Also: OpenID Specs, Key-Value Colon/Newline format

__str__(self)
(Informal representation operator)

source code 

str(x)
Overrides: object.__str__
(inherited documentation)

Instance Variable Details [hide private]

fields


My parameters as a dictionary with each key mapping to one value. Keys are parameter names with no leading "openid.". e.g. "identity" and "mac_key", never "openid.identity".
Type:
dict

request


The request I respond to.
Type:
OpenIDRequest

signed


The names of the fields which should be signed.
Type:
list of str