class documentation

class Headers(typing.MutableMapping[str, str]):

View In Hierarchy

HTTP headers, as a case-insensitive multi-dict.
Method __contains__ Undocumented
Method __delitem__ Remove the header key.
Method __eq__ Undocumented
Method __getitem__ Return a single header value.
Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ Undocumented
Method __repr__ Undocumented
Method __setitem__ Set the header key to value, removing any duplicate entries. Retains insertion order.
Method copy Undocumented
Method encoding.setter Undocumented
Method get Return a header value. If multiple occurrences of the header occur then concatenate them together with commas.
Method get​_list Return a list of all header values for a given key. If split_commas=True is passed, then any comma separated header values are split into multiple return strings.
Method items Return (key, value) items of headers. Concatenate headers into a single comma separated value when a key occurs multiple times.
Method keys Undocumented
Method multi​_items Return a list of (key, value) pairs of headers. Allow multiple occurrences of the same key without concatenating into a single comma separated value.
Method update Undocumented
Method values Undocumented
Property encoding Header encoding is mandated as ascii, but we allow fallbacks to utf-8 or iso-8859-1.
Property raw Returns a list of the raw header items, as byte pairs.
Instance Variable ​_encoding Undocumented
Instance Variable ​_list Undocumented
def __contains__(self, key):

Undocumented

Parameters
key:typing.AnyUndocumented
Returns
boolUndocumented
def __delitem__(self, key):
Remove the header key.
Parameters
key:strUndocumented
def __eq__(self, other):

Undocumented

Parameters
other:typing.AnyUndocumented
Returns
boolUndocumented
def __getitem__(self, key):

Return a single header value.

If there are multiple headers with the same key, then we concatenate them with commas. See: https://tools.ietf.org/html/rfc7230#section-3.2.2

Parameters
key:strUndocumented
Returns
strUndocumented
def __init__(self, headers=None, encoding=None):

Undocumented

Parameters
headers:HeaderTypesUndocumented
encoding:strUndocumented
def __iter__(self):

Undocumented

Returns
typing.Iterator[typing.Any]Undocumented
def __len__(self):

Undocumented

Returns
intUndocumented
def __repr__(self):

Undocumented

Returns
strUndocumented
def __setitem__(self, key, value):
Set the header key to value, removing any duplicate entries. Retains insertion order.
Parameters
key:strUndocumented
value:strUndocumented
def copy(self):

Undocumented

Returns
HeadersUndocumented
@encoding.setter
def encoding(self, value):

Undocumented

Parameters
value:strUndocumented
def get(self, key, default=None):
Return a header value. If multiple occurrences of the header occur then concatenate them together with commas.
Parameters
key:strUndocumented
default:typing.AnyUndocumented
Returns
typing.AnyUndocumented
def get_list(self, key, split_commas=False):
Return a list of all header values for a given key. If split_commas=True is passed, then any comma separated header values are split into multiple return strings.
Parameters
key:strUndocumented
split​_commas:boolUndocumented
Returns
typing.List[str]Undocumented
def items(self):
Return (key, value) items of headers. Concatenate headers into a single comma separated value when a key occurs multiple times.
Returns
typing.ItemsView[str, str]Undocumented
def keys(self):

Undocumented

Returns
typing.KeysView[str]Undocumented
def multi_items(self):
Return a list of (key, value) pairs of headers. Allow multiple occurrences of the same key without concatenating into a single comma separated value.
Returns
typing.List[typing.Tuple[str, str]]Undocumented
def update(self, headers=None):

Undocumented

Parameters
headers:HeaderTypesUndocumented
def values(self):

Undocumented

Returns
typing.ValuesView[str]Undocumented
@property
encoding: str =
Header encoding is mandated as ascii, but we allow fallbacks to utf-8 or iso-8859-1.
@property
raw: typing.List[typing.Tuple[bytes, bytes]] =
Returns a list of the raw header items, as byte pairs.
_encoding =

Undocumented

_list: typing.List[typing.Tuple[bytes, bytes, bytes]] =

Undocumented