← All notes

Python http: HTTPStatus, HTTPMethod, and the standard HTTP submodules

Answer: The http package collects several modules for working with the HyperText Transfer Protocol, plus the HTTPStatus and HTTPMethod enums.

Submodules

http.client speaks HTTP at a low level. For high-level URL opening, use urllib.request.

http.server also contains basic HTTP server classes based on socketserver. http.cookies also has utilities for implementing state management with cookies. http.cookiejar provides persistence of cookies.

HTTPStatus

HTTPStatus was added in version 3.5. It is a subclass of enum.IntEnum that defines HTTP status codes, reason phrases, and long descriptions written in English.

The numeric value is 200, the phrase is OK, and the description is Request fulfilled, document follows.

The codes on the class are the IANA-registered status codes the docs list. list(HTTPStatus) starts with CONTINUE at 100 and SWITCHING_PROTOCOLS at 101.

HTTPMethod

HTTPMethod was added in version 3.11. It is a subclass of enum.StrEnum that defines HTTP methods and descriptions written in English.

Its value is GET, and its description is Retrieve the target.

The documented methods are GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH, and QUERY. The list cites HTTP Semantics RFC 9110 for those methods, RFC 5789 for PATCH, and RFC 10008 for QUERY.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, http — HTTP modules; CPython, http documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, http — HTTP modules; CPython, http documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.

Cite this

Permanent ID: iil:note:kre3p5p2

iinventedlight. 2026. "Python http: HTTPStatus, HTTPMethod, and the standard HTTP submodules." iinventedlight Library, iil:note:kre3p5p2, version of 2026-11-27. https://iinventedlight.com/library/notes/python-http/. License: CC-BY-4.0.

@misc{iil_note_kre3p5p2,
  author = {{iinventedlight}},
  title = {{Python http: HTTPStatus, HTTPMethod, and the standard HTTP submodules}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-27},
  url = {https://iinventedlight.com/library/notes/python-http/},
  note = {Permanent ID iil:note:kre3p5p2. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-http.md.