twisted.web.http_headers.Headers(object)
class documentationtwisted.web.http_headers
View Source
(View In Hierarchy)
This class stores the HTTP headers as both a parsed representation and the raw string representation. It converts between the two on demand.
Method | __init__ | Undocumented |
Method | __repr__ | Return a string fully describing the headers set on this object. |
Method | __cmp__ | Define Headers
instances 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 strings. The keys are capitalized in canonical capitalization. |
Class Variable | _caseMappings | A dict that maps lowercase header names to their canonicalized
representation. |
Instance Variable | _rawHeaders | A dict mapping header names as bytes to
lists of header values as bytes . |
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.
Check for the existence of a given header.
Parameters | name | The name of the HTTP header to check for. (type: bytes ) |
Returns | True if the header exists, otherwise False . (type: bool ) |
Remove the named header from this header object.
Parameters | name | The name of the HTTP header to remove. (type: bytes ) |
Returns | None |
Sets the raw representation of the given header.
Parameters | name | The name of the HTTP header to set the values for. (type: bytes ) |
values | A list of strings each one being a header value of the given name. (type: list ) | |
Returns | None |
Add a new raw value for the given header.
Parameters | name | The name of the header for which to set the value. (type: bytes ) |
value | The value to set for the named header. (type: bytes ) |
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: bytes ) |
default | The value to return if no header with the given name exists. | |
Returns | A list of values for the given header. (type: list ) |
Return an iterator of key, value pairs of all headers contained in this object, as strings. The keys are capitalized in canonical capitalization.
Return the canonical name for the given header.
Parameters | name | The all-lowercase header name to capitalize in its canonical form. (type: bytes ) |
Returns | The canonical name of the header. (type: bytes ) |