t.w.h.Headers(object) : class documentation

Part of twisted.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 str to lists of header values as str.
Method _canonicalNameCaps Return the canonical name for the given header.
_caseMappings =
A dict that maps lowercase header names to their canonicalized representation.
_rawHeaders =
A dict mapping header names as str to lists of header values as str.
def __init__(self, rawHeaders=None): (source)
Undocumented
def __repr__(self): (source)
Return a string fully describing the headers set on this object.
def __cmp__(self, other): (source)
Define Headers instances as being equal to each other if they have the same raw headers.
def copy(self): (source)
Return a copy of itself with the same headers set.
def hasHeader(self, name): (source)
Check for the existence of a given header.
ParametersnameThe name of the HTTP header to check for. (type: str)
ReturnsTrue if the header exists, otherwise False. (type: bool)
def removeHeader(self, name): (source)
Remove the named header from this header object.
ParametersnameThe name of the HTTP header to remove. (type: str)
ReturnsNone
def setRawHeaders(self, name, values): (source)
Sets the raw representation of the given header.
ParametersnameThe name of the HTTP header to set the values for. (type: str)
valuesA list of strings each one being a header value of the given name. (type: list)
ReturnsNone
def addRawHeader(self, name, value): (source)
Add a new raw value for the given header.
ParametersnameThe name of the header for which to set the value. (type: str)
valueThe value to set for the named header. (type: str)
def getRawHeaders(self, name, default=None): (source)
Returns a list of headers matching the given name as the raw string given.
ParametersnameThe name of the HTTP header to get the values of. (type: str)
defaultThe value to return if no header with the given name exists.
ReturnsA list of values for the given header. (type: list)
def getAllRawHeaders(self): (source)
Return an iterator of key, value pairs of all headers contained in this object, as strings. The keys are capitalized in canonical capitalization.
def _canonicalNameCaps(self, name): (source)
Return the canonical name for the given header.
ParametersnameThe all-lowercase header name to capitalize in its canonical form. (type: str)
ReturnsThe canonical name of the header. (type: str)
API Documentation for Twisted, generated by pydoctor at 2012-09-01 11:44:56.