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
- id: C1 claim: http gathers several standard HTTP modules. source: S1 evidence: "collects several modules for working with the"
- id: C2 claim: HTTPStatus is an IntEnum of codes and phrases. source: S1 evidence: "A subclass of enum.IntEnum that defines"
- id: C3 claim: HTTPMethod was added in 3.11 as a StrEnum. source: S2 evidence: "versionadded:: 3.11"
- id: C4 claim: GET's description is Retrieve the target. source: S2 evidence: "Retrieve the target."
- id: C5 claim: http.client is low-level; urllib.request is the high-level opener. source: S1 evidence: "low-level HTTP protocol client"
Sources
- [S1] http — HTTP modules. Python Software Foundation. https://docs.python.org/3/library/http.html . License: PSF License Version 2. Accessed 2026-11-27.
- [S2] http documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/http.rst . License: PSF License Version 2. Accessed 2026-11-27.
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
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.},
}
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.
- python-http.schema.json (schema; CC-BY-4.0)
- python-http.table.json (table; CC-BY-4.0)
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.