Lint for HTTP messages.
Project description
httplint
This Python library lints HTTP messages; it checks them for correctness and reports any issues it finds. httplint can report on 237 different aspects of your HTTP message, including checks against 164 header fields.
It performs all message-level checks for REDbot, but does not perform any 'active' checks by making requests to the network, and it does not have a Web user interface.
Using httplint as a Library
httplint exposes two classes for linting: HttpRequestLinter and HttpResponseLinter. They expose the following methods for telling the linter about the HTTP message:
- As appropriate:
process_request_topline, which takes threebytesarguments:method,uri, andversionprocess_response_topline, which takes threebytesarguments:version,status_code, andstatus_phrase
process_headersfor the headers, taking a list of (name,value) tuples (bothbytes)feed_contentfor the body (which can be called zero to many times), taking aninbytesargumentfinish_contentwhen done, which has two arguments; aboolindicating whether the response was complete, and an optional list of tuples for the trailers, in the same format thatprocess_headerstakes.
For example:
from httplint import HttpResponseLinter
linter = HttpResponseLinter()
linter.process_response_topline(b'HTTP/1.1', b'200', b'OK')
linter.process_headers([
(b'Content-Type', b'text/plain'),
(b'Content-Length', b'10'),
(b'Cache-Control', b'max-age=60')
])
linter.feed_content(b'12345')
linter.feed_content(b'67890')
linter.finish_content(True)
You can also enable no_content mode if you do not have the message body, or do not wish to check it:
linter = HttpResponseLinter(no_content=True)
Using httplint from the Command Line
httplint can also be used from the command line. For example:
> curl -s -i --raw https://www.mnot.net/ | httplint -n
* The Content-Length header is correct.
* The resource last changed 8 days 6 hr ago.
* This response allows all caches to store it.
* The server's clock is correct.
* This response is fresh until 3 hr from now.
* This response may still be served by a cache once it becomes stale.
Interpreting Notes
Once a message has been linted, the results will appear on the notes property. This is a list of Note objects, each having the following attributes:
category- the Note's category; seenote.categorieslevel- seenote.levelssummary- a brief, one-line description of the notedetail- a longer explanationsubnotes- a list of childNoteobjects
Note that summary is textual, and needs to be escaped in a markup environment; detail, however, is already escaped HTML.
Continuing our example:
for note in linter.notes:
print(note.summary)
and the output should be:
The Content-Length header is correct.
This response allows all caches to store it.
This response doesn't have a Date header.
This response is fresh until 1 min from now.
This response may still be served by a cache once it becomes stale.
Field Descriptions
The description of any field can be found by calling get_field_description. For example:
>>> from httplint import get_field_description
>>> get_field_description("Allow")
'The `Allow` response header advertises the set of methods that are supported by the resource.'
If a description cannot be found it will return None.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file httplint-2026.2.3.tar.gz.
File metadata
- Download URL: httplint-2026.2.3.tar.gz
- Upload date:
- Size: 618.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e20909347bd6063a0fabba45b8a032bd9d3b01ae1626381ae6a2708a5a29b107
|
|
| MD5 |
dbf8f318bd70058128d982e656633c87
|
|
| BLAKE2b-256 |
2d92de795793777cc776cde2fb4301659587d09b6b0a69b732e119a157264b45
|
Provenance
The following attestation bundles were made for httplint-2026.2.3.tar.gz:
Publisher:
publish.yml on mnot/httplint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
httplint-2026.2.3.tar.gz -
Subject digest:
e20909347bd6063a0fabba45b8a032bd9d3b01ae1626381ae6a2708a5a29b107 - Sigstore transparency entry: 923413859
- Sigstore integration time:
-
Permalink:
mnot/httplint@1fbf184895f0e612a3501dcc81855e2c2be2c152 -
Branch / Tag:
refs/tags/v2026.02.3 - Owner: https://github.com/mnot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1fbf184895f0e612a3501dcc81855e2c2be2c152 -
Trigger Event:
push
-
Statement type:
File details
Details for the file httplint-2026.2.3-py3-none-any.whl.
File metadata
- Download URL: httplint-2026.2.3-py3-none-any.whl
- Upload date:
- Size: 704.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
098d9f0e3d1d5bffcc2f580dea689d2915998ad0c005478b3501cb2bd888cfef
|
|
| MD5 |
28ac1b32a4024383326373515486ebfc
|
|
| BLAKE2b-256 |
4266d747df3e8cfb73c2894d8970b179f34108f39f897b38b98f09b593c62cfa
|
Provenance
The following attestation bundles were made for httplint-2026.2.3-py3-none-any.whl:
Publisher:
publish.yml on mnot/httplint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
httplint-2026.2.3-py3-none-any.whl -
Subject digest:
098d9f0e3d1d5bffcc2f580dea689d2915998ad0c005478b3501cb2bd888cfef - Sigstore transparency entry: 923413864
- Sigstore integration time:
-
Permalink:
mnot/httplint@1fbf184895f0e612a3501dcc81855e2c2be2c152 -
Branch / Tag:
refs/tags/v2026.02.3 - Owner: https://github.com/mnot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1fbf184895f0e612a3501dcc81855e2c2be2c152 -
Trigger Event:
push
-
Statement type: