Skip to main content

httplint

This Python library lints HTTP messages; it checks them for correctness and reports any issues it finds. httplint can report on 326 different aspects of your HTTP message, including checks against 199 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 three bytes arguments: method, uri, and version
    • process_response_topline, which takes three bytes arguments: version, status_code, and status_phrase
  • process_headers for the headers, taking a list of (name, value) tuples (both bytes)
  • feed_content for the body (which can be called zero to many times), taking an inbytes argument
  • finish_content when done, which has two arguments; a bool indicating whether the response was complete, and an optional list of tuples for the trailers, in the same format that process_headers takes.

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; see note.categories
  • level - see note.levels
  • summary - a brief, one-line description of the note
  • detail - a longer explanation
  • subnotes - a list of child Note objects

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.

Release files for httplint 2026.9.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for httplint 2026.9.2
File Size Uploaded
httplint-2026.9.2.tar.gz 635.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for httplint 2026.9.2
File Interpreter ABI Platform
httplint-2026.9.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / httplint-2026.9.2.tar.gz

Download URL httplint-2026.9.2.tar.gz
Size 635.8 kB
Tags Source
SHA-256 checksum
How to use checksums
131b578af24615650af0c85192bf93bad1153ee575322e447bc52d116646ede8
BLAKE2b-256 checksum
How to use checksums
39352932303ad7accb05720f54a20e62653efbdf359cda0a08621f74ad91d009
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 Sep 21, 2026.

Transparency log

Release files / httplint-2026.9.2-py3-none-any.whl

Download URL httplint-2026.9.2-py3-none-any.whl
Size 699.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d576c9e92956e1f37b1800e5268ff9d7f9971dc1511bc912d6a410b604be55e
BLAKE2b-256 checksum
How to use checksums
0180c2e7469516a52bd76c45cef8b11a1f3256e324a37818698a0abe035b669c
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 Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.9.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page