class HeaderSet(MutableSet):
Similar to the ETags
class this implements a set-like structure.
Unlike ETags
this is case insensitive and used for vary, allow, and
content-language headers.
If not constructed using the parse_set_header
function the
instantiation works like this:
>>> hs = HeaderSet(['foo', 'bar', 'baz']) >>> hs HeaderSet(['foo', 'bar', 'baz'])
Method | __bool__ |
Undocumented |
Method | __contains__ |
Undocumented |
Method | __delitem__ |
Undocumented |
Method | __getitem__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __len__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __setitem__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | add |
Add a new header to the set. |
Method | as_set |
Return the set as real python set type. When calling this, all the items are converted to lowercase and the ordering is lost. |
Method | clear |
Clear the set. |
Method | discard |
Like remove but ignores errors. |
Method | find |
Return the index of the header in the set or return -1 if not found. |
Method | index |
Return the index of the header in the set or raise an IndexError . |
Method | remove |
Remove a header from the set. This raises an KeyError if the header is not in the set. |
Method | to_header |
Convert the header set into an HTTP header string. |
Method | update |
Add all the headers from the iterable to the set. |
Instance Variable | on_update |
Undocumented |
Instance Variable | _headers |
Undocumented |
Instance Variable | _set |
Undocumented |
Parameters | |
preserve_casing | if set to True the items in the set returned
will have the original case like in the
HeaderSet , otherwise they will
be lowercase. |
remove
but ignores errors.Parameters | |
header | the header to be discarded. |
Parameters | |
header | the header to be looked up. |
IndexError
.Parameters | |
header | the header to be looked up. |
Remove a header from the set. This raises an KeyError
if the
header is not in the set.
IndexError
was raised instead of a
KeyError
if the object was missing.Parameters | |
header | the header to be removed. |