On this page
  1. http.HTTPStatus
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

http.HTTPStatus

Prev: http.HTTPMethod | Up: http
Rel: http.HTTPMethod
Ref: docs.python.org — http.HTTPStatus
Tags: #public #python3 #stdlib #http


Import

import http
from http import HTTPStatus

Signature & Overview

http.HTTPStatus(*values)

HTTP status codes and reason phrases Status codes from the following RFCs are all observed: * RFC 9110: HTTP Semantics, obsoletes 7231, which obsoleted 2616

Methods & Attributes

Usage

from http import HTTPStatus

status = HTTPStatus.NOT_FOUND
assert status == 404 and status.phrase == "Not Found"
assert HTTPStatus(200) is HTTPStatus.OK

Gotchas

REPL Inspect

from http import HTTPStatus
help(HTTPStatus)

Linked from

Related notes