class HeaderSet(MutableSet): (source)
Similar to the :class:`ETags` class this implements a set-like structure. Unlike :class:`ETags` this is case insensitive and used for vary, allow, and content-language headers. If not constructed using the :func:`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 |
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 :meth:`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 :exc:`IndexError`. |
Method | remove |
Remove a header from the set. This raises an :exc:`KeyError` if the header is not in the set. |
Method | to |
Convert the header set into an HTTP header string. |
Method | update |
Add all the headers from the iterable to the set. |
Instance Variable | on |
Undocumented |
Instance Variable | _headers |
Undocumented |
Instance Variable | _set |
Undocumented |
Return the set as real python set type. When calling this, all the items are converted to lowercase and the ordering is lost. :param preserve_casing: if set to `True` the items in the set returned will have the original case like in the :class:`HeaderSet`, otherwise they will be lowercase.
Return the index of the header in the set or return -1 if not found. :param header: the header to be looked up.
Return the index of the header in the set or raise an :exc:`IndexError`. :param header: the header to be looked up.
Remove a header from the set. This raises an :exc:`KeyError` if the header is not in the set. .. versionchanged:: 0.5 In older versions a :exc:`IndexError` was raised instead of a :exc:`KeyError` if the object was missing. :param header: the header to be removed.