twisted.web.http_headers.Headers(object) class documentationtwisted.web.http_headers
(View In Hierarchy)
Stores HTTP headers in a key and multiple value format.
Most methods accept bytes
and unicode, 
with an internal bytes
representation. When passed unicode, header 
names (e.g. 'Content-Type') are encoded using ISO-8859-1 and header values 
(e.g. 'text/html;charset=utf-8') are encoded using UTF-8. Some methods that
return values will return them in the same type as the name given.
If the header keys or values cannot be encoded or decoded using the 
rules above, using just bytes
arguments to the methods of this class will ensure no decoding or encoding 
is done, and Headers will 
treat the keys and values as opaque byte strings.
| Method | __init__ | Undocumented | 
| Method | __repr__ | Return a string fully describing the headers set on this object. | 
| Method | __cmp__ | Define Headersinstances as being equal to each other if they have the same raw 
headers. | 
| Method | copy | Return a copy of itself with the same headers set. | 
| Method | hasHeader | Check for the existence of a given header. | 
| Method | removeHeader | Remove the named header from this header object. | 
| Method | setRawHeaders | Sets the raw representation of the given header. | 
| Method | addRawHeader | Add a new raw value for the given header. | 
| Method | getRawHeaders | Returns a list of headers matching the given name as the raw string given. | 
| Method | getAllRawHeaders | Return an iterator of key, value pairs of all headers contained in this 
object, as bytes.
The keys are capitalized in canonical capitalization. | 
| Class Variable | _caseMappings | A dictthat maps lowercase header names to their canonicalized representation. | 
| Instance Variable | _rawHeaders | A dictmapping header names asbytestolists
of header values asbytes. | 
| Method | _encodeName | Encode the name of a header (eg 'Content-Type') to an ISO-8859-1 encoded bytestring if required. | 
| Method | _encodeValue | Encode a single header value to a UTF-8 encoded bytestring if required. | 
| Method | _encodeValues | Encode a listof header values to alistof UTF-8 encoded bytestrings if required. | 
| Method | _decodeValues | Decode a listof header values into alistof Unicode strings. | 
| Method | _canonicalNameCaps | Return the canonical name for the given header. | 
Define Headers 
instances as being equal to each other if they have the same raw 
headers.
Returns a list of headers matching the given name as the raw string given.
| Parameters | name | The name of the HTTP header to get the values of. (type: bytesorunicode) | 
| default | The value to return if no header with the given nameexists. | |
| Returns | If the named header is present, a listof its values.  Otherwise,default. (type:listof strings, same type asname(except whendefaultis returned).) | |
Return an iterator of key, value pairs of all headers contained in this 
object, as bytes.
The keys are capitalized in canonical capitalization.