Package wtf :: Package app :: Module response :: Class HeaderCollection
[hide private]
[frames] | no frames]

Class HeaderCollection

source code

object --+
         |
        HeaderCollection

Response header collection representation

Note that all header names are treated case insensitive (by lowering them)

Instance Methods [hide private]
 
__init__(self)
Initialization
source code
bool
__contains__(self, name)
Check if header is already set
source code
 
__iter__(self)
Header tuple iterator
source code
list
get(self, name)
Determine the value list of a header
source code
 
set(self, name, *values)
Set a header, replacing any same-named header previously set
source code
 
add(self, name, *values)
Add a value list to a header
source code
 
remove(self, name, value=None)
Remove a header by name (plus optionally by value)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
dict _headers
The headers ({'name': ['value', ...], ...})
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Initialization
Overrides: object.__init__

__contains__(self, name)
(In operator)

source code 
Check if header is already set
Parameters:
  • name (str) - Header name
Returns: bool
Does the header already exist?

get(self, name)

source code 
Determine the value list of a header
Parameters:
  • name (str) - The header name
Returns: list
The value list or None

set(self, name, *values)

source code 
Set a header, replacing any same-named header previously set
Parameters:
  • name (str) - The header name
  • values (tuple) - List of values (('value', ...))

add(self, name, *values)

source code 

Add a value list to a header

The old values are preserved

Parameters:
  • name (str) - Header name
  • values (tuple) - Values to add (('value', ...))

remove(self, name, value=None)

source code 

Remove a header by name (plus optionally by value)

If the header does not exist alrady, it is not an error.

Parameters:
  • name (str) - Header name
  • value (str) - Particular value to remove