http-fields
Typed, validated HTTP headers for Python. Each header is an immutable dataclass whose fields are the structured components of the header. abnf grammars are used both to parse incoming header strings and to validate field values, so a constructed header is always well-formed.
Requires Python 3.10+.
from http_fields import ContentType, Header
ct = ContentType.parse("text/html; charset=UTF-8")
ct.type, ct.subtype, ct.charset # ('text', 'html', 'UTF-8')
str(ct) # 'Content-Type: text/html;charset=UTF-8'
ContentType.of(type="text", subtype="html", charset="utf-8") # build from pieces
Header.create("x-request-id", "abc123") # dispatch by name
Install
uv add http-fields
# or: pip install http-fields
Documentation
Full documentation: https://http-fields.readthedocs.io/
It follows the Diátaxis model:
- Tutorial: Getting started
- How-to guides: parse & build · custom / unknown headers · Structured Fields
- Reference:
header catalog ·
structuredfieldsAPI - Explanation: the header model
The sources live in docs/.
Development
uv sync # create the environment
uv run pytest # run the tests
uv run ruff check . # lint
uv run ruff format . # format
uv run basedpyright # type-check
uv sync --group docs # add the docs toolchain
uv run sphinx-build -b html docs docs/_build/html # build the docs locally
Metadata
Release files for http-fields 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| http_fields-0.1.2.tar.gz | 95.0 kB | With provenance | Details for http_fields-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| http_fields-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for http_fields-0.1.2-py3-none-any.whl |
Total release size: 202.4 kB
Release files / http_fields-0.1.2.tar.gz
| Download URL | http_fields-0.1.2.tar.gz |
|---|---|
| Size | 95.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5a010578e19e5bb5d26573de2d37907fe3fb76c1fdbfd38939dcb675223bb92
|
|
BLAKE2b-256 checksum How to use checksums |
ed000fe195bf9e1954702d4a25915d250bc0bb342333ee42887f8ea4c9c069b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logRelease files / http_fields-0.1.2-py3-none-any.whl
| Download URL | http_fields-0.1.2-py3-none-any.whl |
|---|---|
| Size | 107.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c1b1cf19f6c6f9d1c071696e44a16d5fff79843f55ef5bbe20afbe9d1b21e65
|
|
BLAKE2b-256 checksum How to use checksums |
fa740a9ff204af29e823c689281c02ae197c2794d9fd9144fb1a5075f6b21f52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logSecurity for http-fields 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for http_fields-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.