Headers

The Headers class provides an immutable case-insensitive multidict interface for accessing HTTP headers.

httpx
>>> headers = httpx.Headers({"Accept": "*/*"})
>>> headers
<Headers {"Accept": "*/*"}>
>>> headers['accept']
'*/*'

Header values should always be printable ASCII strings. Attempting to set invalid header name or value strings will raise a ValueError.

Accessing headers

Headers are accessed using a standard dictionary style interface...

The following methods are also available for accessing headers as a multidict...

Modifying headers

The following methods can be used to create modified header instances...


URLs Content Types