duck.utils.headersΒΆ

Headers utilities module.

Module ContentsΒΆ

FunctionsΒΆ

parse_headers_from_bytes

Parse headers from bytes and store all headers as lists, even if they appear once.

APIΒΆ

duck.utils.headers.parse_headers_from_bytes(data: bytes, delimiter: str = '\r\n') β†’ Dict[str, List[str]][source]ΒΆ

Parse headers from bytes and store all headers as lists, even if they appear once.

Parameters:
  • data – The raw header data in bytes format.

  • delimiter – Delimiter separating headers.

Returns:

A dictionary with header names as keys (in lowercase) and lists of their respective values.

Return type:

Dict[str, List[str]]