Commit cb18b95a authored by Berker Peksag's avatar Berker Peksag

Issue #20898: Add a "HTTP status codes" section to avoid duplication in HTTP docs.

This commit also removes a couple of non-standard status codes. They were
added as part of edf669b13482, so there is no backwards compatibility issue.

Patch by Demian Brecht.
parent ed741d4f
...@@ -180,221 +180,15 @@ The constants defined in this module are: ...@@ -180,221 +180,15 @@ The constants defined in this module are:
The default port for the HTTPS protocol (always ``443``). The default port for the HTTPS protocol (always ``443``).
and also the following constants for integer status codes:
+------------------------------------------+---------+-----------------------------------------------------------------------+
| Constant | Value | Definition |
+==========================================+=========+=======================================================================+
| :const:`CONTINUE` | ``100`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.1.1 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1.1>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`SWITCHING_PROTOCOLS` | ``101`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.1.2 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1.2>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`PROCESSING` | ``102`` | WEBDAV, `RFC 2518, Section 10.1 |
| | | <http://www.webdav.org/specs/rfc2518.html#STATUS_102>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`OK` | ``200`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.2.1 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`CREATED` | ``201`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.2.2 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.2>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`ACCEPTED` | ``202`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.2.3 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.3>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`NON_AUTHORITATIVE_INFORMATION` | ``203`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.2.4 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.4>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`NO_CONTENT` | ``204`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.2.5 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`RESET_CONTENT` | ``205`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.2.6 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.6>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`PARTIAL_CONTENT` | ``206`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.2.7 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.7>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`MULTI_STATUS` | ``207`` | WEBDAV `RFC 2518, Section 10.2 |
| | | <http://www.webdav.org/specs/rfc2518.html#STATUS_207>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`IM_USED` | ``226`` | Delta encoding in HTTP, |
| | | :rfc:`3229`, Section 10.4.1 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`MULTIPLE_CHOICES` | ``300`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.3.1 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`MOVED_PERMANENTLY` | ``301`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.3.2 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`FOUND` | ``302`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.3.3 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.3>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`SEE_OTHER` | ``303`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.3.4 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`NOT_MODIFIED` | ``304`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.3.5 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`USE_PROXY` | ``305`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.3.6 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.6>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`TEMPORARY_REDIRECT` | ``307`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.3.8 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.8>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`BAD_REQUEST` | ``400`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.1 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`UNAUTHORIZED` | ``401`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.2 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`PAYMENT_REQUIRED` | ``402`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.3 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.3>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`FORBIDDEN` | ``403`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.4 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`NOT_FOUND` | ``404`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.5 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`METHOD_NOT_ALLOWED` | ``405`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.6 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`NOT_ACCEPTABLE` | ``406`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.7 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`PROXY_AUTHENTICATION_REQUIRED` | ``407`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.8 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.8>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`REQUEST_TIMEOUT` | ``408`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.9 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.9>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`CONFLICT` | ``409`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.10 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`GONE` | ``410`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.11 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.11>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`LENGTH_REQUIRED` | ``411`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.12 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.12>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`PRECONDITION_FAILED` | ``412`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.13 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.13>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`REQUEST_ENTITY_TOO_LARGE` | ``413`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.14 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.14>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`REQUEST_URI_TOO_LONG` | ``414`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.15 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.15>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`UNSUPPORTED_MEDIA_TYPE` | ``415`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.16 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`REQUESTED_RANGE_NOT_SATISFIABLE` | ``416`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.17 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.17>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`EXPECTATION_FAILED` | ``417`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.4.18 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.18>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`UNPROCESSABLE_ENTITY` | ``422`` | WEBDAV, `RFC 2518, Section 10.3 |
| | | <http://www.webdav.org/specs/rfc2518.html#STATUS_422>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`LOCKED` | ``423`` | WEBDAV `RFC 2518, Section 10.4 |
| | | <http://www.webdav.org/specs/rfc2518.html#STATUS_423>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`FAILED_DEPENDENCY` | ``424`` | WEBDAV, `RFC 2518, Section 10.5 |
| | | <http://www.webdav.org/specs/rfc2518.html#STATUS_424>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`UPGRADE_REQUIRED` | ``426`` | HTTP Upgrade to TLS, |
| | | :rfc:`2817`, Section 6 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`PRECONDITION_REQUIRED` | ``428`` | Additional HTTP Status Codes, |
| | | :rfc:`6585`, Section 3 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`TOO_MANY_REQUESTS` | ``429`` | Additional HTTP Status Codes, |
| | | :rfc:`6585`, Section 4 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`REQUEST_HEADER_FIELDS_TOO_LARGE` | ``431`` | Additional HTTP Status Codes, |
| | | :rfc:`6585`, Section 5 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`INTERNAL_SERVER_ERROR` | ``500`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.5.1 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`NOT_IMPLEMENTED` | ``501`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.5.2 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`BAD_GATEWAY` | ``502`` | HTTP/1.1 `RFC 2616, Section |
| | | 10.5.3 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.3>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`SERVICE_UNAVAILABLE` | ``503`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.5.4 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`GATEWAY_TIMEOUT` | ``504`` | HTTP/1.1 `RFC 2616, Section |
| | | 10.5.5 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.5>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`HTTP_VERSION_NOT_SUPPORTED` | ``505`` | HTTP/1.1, `RFC 2616, Section |
| | | 10.5.6 |
| | | <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.6>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`INSUFFICIENT_STORAGE` | ``507`` | WEBDAV, `RFC 2518, Section 10.6 |
| | | <http://www.webdav.org/specs/rfc2518.html#STATUS_507>`_ |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`NOT_EXTENDED` | ``510`` | An HTTP Extension Framework, |
| | | :rfc:`2774`, Section 7 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
| :const:`NETWORK_AUTHENTICATION_REQUIRED` | ``511`` | Additional HTTP Status Codes, |
| | | :rfc:`6585`, Section 6 |
+------------------------------------------+---------+-----------------------------------------------------------------------+
.. versionchanged:: 3.3
Added codes ``428``, ``429``, ``431`` and ``511`` from :rfc:`6585`.
.. data:: responses .. data:: responses
This dictionary maps the HTTP 1.1 status codes to the W3C names. This dictionary maps the HTTP 1.1 status codes to the W3C names.
Example: ``http.client.responses[http.client.NOT_FOUND]`` is ``'Not Found'``. Example: ``http.client.responses[http.client.NOT_FOUND]`` is ``'Not Found'``.
See :ref:`http-status-codes` for a list of HTTP status codes that are
available in this module as constants.
.. _httpconnection-objects: .. _httpconnection-objects:
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
**Source code:** :source:`Lib/http/__init__.py` **Source code:** :source:`Lib/http/__init__.py`
:mod:`http` is a also package that collects several modules for working with the :mod:`http` is a package that collects several modules for working with the
HyperText Transfer Protocol: HyperText Transfer Protocol:
* :mod:`http.client` is a low-level HTTP protocol client; for high-level URL * :mod:`http.client` is a low-level HTTP protocol client; for high-level URL
...@@ -45,85 +45,79 @@ associated messages through the :class:`http.HTTPStatus` enum: ...@@ -45,85 +45,79 @@ associated messages through the :class:`http.HTTPStatus` enum:
>>> list(HTTPStatus) >>> list(HTTPStatus)
[<HTTPStatus.CONTINUE: 100>, <HTTPStatus.SWITCHING_PROTOCOLS: 101>, ...] [<HTTPStatus.CONTINUE: 100>, <HTTPStatus.SWITCHING_PROTOCOLS: 101>, ...]
The supported HTTP status codes are: .. _http-status-codes:
=== ============================== HTTP status codes
100 Continue -----------------
101 Switching Protocols
102 Processing Supported,
200 OK `IANA-registered <http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml>`_
201 Created status codes available in :class:`http.HTTPStatus` are:
202 Accepted
203 Non-Authoritative Information ======= =================================== ==================================================================
204 No Content Code Enum Name Details
205 Reset Content ======= =================================== ==================================================================
206 Partial Content ``100`` ``CONTINUE`` HTTP/1.1 :rfc:`7231`, Section 6.2.1
207 Multi-Status ``101`` ``SWITCHING_PROTOCOLS`` HTTP/1.1 :rfc:`7231`, Section 6.2.2
208 Already Reported ``102`` ``PROCESSING`` WebDAV :rfc:`2518`, Section 10.1
226 IM Used ``200`` ``OK`` HTTP/1.1 :rfc:`7231`, Section 6.3.1
300 Multiple Choices ``201`` ``CREATED`` HTTP/1.1 :rfc:`7231`, Section 6.3.2
301 Moved Permanently ``202`` ``ACCEPTED`` HTTP/1.1 :rfc:`7231`, Section 6.3.3
302 Found ``203`` ``NON_AUTHORITATIVE_INFORMATION`` HTTP/1.1 :rfc:`7231`, Section 6.3.4
303 See Other ``204`` ``NO_CONTENT`` HTTP/1.1 :rfc:`7231`, Section 6.3.5
304 Not Modified ``205`` ``RESET_CONTENT`` HTTP/1.1 :rfc:`7231`, Section 6.3.6
305 Use Proxy ``206`` ``PARTIAL_CONTENT`` HTTP/1.1 :rfc:`7233`, Section 4.1
306 Switch Proxy ``207`` ``MULTI_STATUS`` WebDAV :rfc:`4918`, Section 11.1
307 Temporary Redirect ``208`` ``ALREADY_REPORTED`` WebDAV Binding Extensions :rfc:`5842`, Section 7.1 (Experimental)
308 Permanent Redirect ``226`` ``IM_USED`` Delta Encoding in HTTP :rfc:`3229`, Section 10.4.1
400 Bad Request ``300`` ``MULTIPLE_CHOICES`` HTTP/1.1 :rfc:`7231`, Section 6.4.1
401 Unauthorized ``301`` ``MOVED_PERMANENTLY`` HTTP/1.1 :rfc:`7231`, Section 6.4.2
402 Payment Required ``302`` ``FOUND`` HTTP/1.1 :rfc:`7231`, Section 6.4.3
403 Forbidden ``303`` ``SEE_OTHER`` HTTP/1.1 :rfc:`7231`, Section 6.4.4
404 Not Found ``304`` ``NOT_MODIFIED`` HTTP/1.1 :rfc:`7232`, Section 4.1
405 Method Not Allowed ``305`` ``USE_PROXY`` HTTP/1.1 :rfc:`7231`, Section 6.4.5
406 Not Acceptable ``307`` ``TEMPORARY_REDIRECT`` HTTP/1.1 :rfc:`7231`, Section 6.4.7
407 Proxy Authentication Required ``308`` ``PERMANENT_REDIRECT`` Permanent Redirect :rfc:`7238`, Section 3 (Experimental)
408 Request Timeout ``400`` ``BAD_REQUEST`` HTTP/1.1 :rfc:`7231`, Section 6.5.1
409 Conflict ``401`` ``UNAUTHORIZED`` HTTP/1.1 Authentication :rfc:`7235`, Section 3.1
410 Gone ``402`` ``PAYMENT_REQUIRED`` HTTP/1.1 :rfc:`7231`, Section 6.5.2
411 Length Required ``403`` ``FORBIDDEN`` HTTP/1.1 :rfc:`7231`, Section 6.5.3
412 Precondition Failed ``404`` ``NOT_FOUND`` HTTP/1.1 :rfc:`7231`, Section 6.5.4
413 Request Entity Too Large ``405`` ``METHOD_NOT_ALLOWED`` HTTP/1.1 :rfc:`7231`, Section 6.5.5
414 Request URI Too Long ``406`` ``NOT_ACCEPTABLE`` HTTP/1.1 :rfc:`7231`, Section 6.5.6
415 Unsupported Media Type ``407`` ``PROXY_AUTHENTICATION_REQUIRED`` HTTP/1.1 Authentication :rfc:`7235`, Section 3.2
416 Request Range Not Satisfiable ``408`` ``REQUEST_TIMEOUT`` HTTP/1.1 :rfc:`7231`, Section 6.5.7
417 Expectation Failed ``409`` ``CONFLICT`` HTTP/1.1 :rfc:`7231`, Section 6.5.8
418 I'm a teapot ``410`` ``GONE`` HTTP/1.1 :rfc:`7231`, Section 6.5.9
419 Authentication Timeout ``411`` ``LENGTH_REQUIRED`` HTTP/1.1 :rfc:`7231`, Section 6.5.10
420 Method Failure *(Spring framework)* ``412`` ``PRECONDITION_FAILED`` HTTP/1.1 :rfc:`7232`, Section 4.2
422 Unprocessable Entity ``413`` ``REQUEST_ENTITY_TOO_LARGE`` HTTP/1.1 :rfc:`7231`, Section 6.5.11
423 Locked ``414`` ``REQUEST_URI_TOO_LONG`` HTTP/1.1 :rfc:`7231`, Section 6.5.12
424 Failed Dependency ``415`` ``UNSUPPORTED_MEDIA_TYPE`` HTTP/1.1 :rfc:`7231`, Section 6.5.13
426 Upgrade Required ``416`` ``REQUEST_RANGE_NOT_SATISFIABLE`` HTTP/1.1 Range Requests :rfc:`7233`, Section 4.4
428 Precondition Required ``417`` ``EXPECTATION_FAILED`` HTTP/1.1 :rfc:`7231`, Section 6.5.14
429 Too Many Requests ``422`` ``UNPROCESSABLE_ENTITY`` WebDAV :rfc:`4918`, Section 11.2
431 Request Header Field Too Large ``423`` ``LOCKED`` WebDAV :rfc:`4918`, Section 11.3
440 Login Timeout *(Microsoft)* ``424`` ``FAILED_DEPENDENCY`` WebDAV :rfc:`4918`, Section 11.4
444 No Response *(Nginx)* ``426`` ``UPGRADE_REQUIRED`` HTTP/1.1 :rfc:`7231`, Section 6.5.15
449 Retry With *(Microsoft)* ``428`` ``PRECONDITION_REQUIRED`` Additional HTTP Status Codes :rfc:`6585`
450 Blocked By Windows Parental Controls *(Microsoft)* ``429`` ``TOO_MANY_REQUESTS`` Additional HTTP Status Codes :rfc:`6585`
494 Request Header Too Large *(Nginx)* ``431`` ``REQUEST_HEADER_FIELDS_TOO_LARGE`` Additional HTTP Status Codes :rfc:`6585`
495 Cert Error *(Nginx)* ``500`` ``INTERNAL_SERVER_ERROR`` HTTP/1.1 :rfc:`7231`, Section 6.6.1
496 No Cert *(Nginx)* ``501`` ``NOT_IMPLEMENTED`` HTTP/1.1 :rfc:`7231`, Section 6.6.2
497 HTTP To HTTPS *(Nginx)* ``502`` ``BAD_GATEWAY`` HTTP/1.1 :rfc:`7231`, Section 6.6.3
499 Client Closed Request *(Nginx)* ``503`` ``SERVICE_UNAVAILABLE`` HTTP/1.1 :rfc:`7231`, Section 6.6.4
500 Internal Server Error ``504`` ``GATEWAY_TIMEOUT`` HTTP/1.1 :rfc:`7231`, Section 6.6.5
501 Not Implemented ``505`` ``HTTP_VERSION_NOT_SUPPORTED`` HTTP/1.1 :rfc:`7231`, Section 6.6.6
502 Bad Gateway ``506`` ``VARIANT_ALSO_NEGOTIATES`` Transparent Content Negotiation in HTTP :rfc:`2295`, Section 8.1 (Experimental)
503 Service Unavailable ``507`` ``INSUFFICIENT_STORAGE`` WebDAV :rfc:`4918`, Section 11.5
504 Gateway Timeout ``508`` ``LOOP_DETECTED`` WebDAV Binding Extensions :rfc:`5842`, Section 7.2 (Experimental)
505 HTTP Version Not Supported ``510`` ``NOT_EXTENDED`` An HTTP Extension Framework :rfc:`2774`, Section 7 (Experimental)
506 Variant Also Negotiates ``511`` ``NETWORK_AUTHENTICATION_REQUIRED`` Additional HTTP Status Codes :rfc:`6585`, Section 6
507 Insufficient Storage ======= =================================== ==================================================================
508 Loop Detected
509 Bandwidth Limit Exceeded In order to preserve backwards compatibility, enum values are also present
510 Not Extended in the :mod:`http.client` and :mod:`http.server` modules in the form of
511 Network Authentication Required constants. The enum name is equal to the constant name (i.e.
520 Origin Error *(CloudFlare)* ``http.HTTPStatus.OK`` is also available as ``http.client.OK`` and
521 Web Server Is Down *(CloudFlare)* ``http.server.OK``).
522 Connection Timed Out *(CloudFlare)*
523 Proxy Declined Request *(CloudFlare)*
524 A Timeout Occurred *(CloudFlare)*
598 Network Read Timeout Error
599 Network Connect Timeout Error
=== ==============================
...@@ -13,16 +13,8 @@ class HTTPStatus(IntEnum): ...@@ -13,16 +13,8 @@ class HTTPStatus(IntEnum):
* RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518 * RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518
* RFC 5842: Binding Extensions to WebDAV * RFC 5842: Binding Extensions to WebDAV
* RFC 7238: Permanent Redirect * RFC 7238: Permanent Redirect
* RFC 2324: Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)
* RFC 2295: Transparent Content Negotiation in HTTP * RFC 2295: Transparent Content Negotiation in HTTP
* RFC 2774: An HTTP Extension Framework * RFC 2774: An HTTP Extension Framework
Non-standard vendor codes include:
* Spring framework: 420
* Nginx: 444, 494, 495, 496, 497, 499
* Microsoft: 440, 449, 450
* Cloudflare: 520, 521, 522, 523, 524, 598, 599
""" """
def __new__(cls, value, phrase, description=''): def __new__(cls, value, phrase, description=''):
obj = int.__new__(cls, value) obj = int.__new__(cls, value)
...@@ -63,7 +55,6 @@ class HTTPStatus(IntEnum): ...@@ -63,7 +55,6 @@ class HTTPStatus(IntEnum):
'Document has not changed since given time') 'Document has not changed since given time')
USE_PROXY = (305, 'Use Proxy', USE_PROXY = (305, 'Use Proxy',
'You must use proxy specified in Location to access this resource') 'You must use proxy specified in Location to access this resource')
SWITCH_PROXY = 306, 'Switch Proxy'
TEMPORARY_REDIRECT = (307, 'Temporary Redirect', TEMPORARY_REDIRECT = (307, 'Temporary Redirect',
'Object moved temporarily -- see URI list') 'Object moved temporarily -- see URI list')
PERMANENT_REDIRECT = (308, 'Permanent Redirect', PERMANENT_REDIRECT = (308, 'Permanent Redirect',
...@@ -107,9 +98,6 @@ class HTTPStatus(IntEnum): ...@@ -107,9 +98,6 @@ class HTTPStatus(IntEnum):
'Cannot satisfy request range') 'Cannot satisfy request range')
EXPECTATION_FAILED = (417, 'Expectation Failed', EXPECTATION_FAILED = (417, 'Expectation Failed',
'Expect condition could not be satisfied') 'Expect condition could not be satisfied')
IM_A_TEAPOT = 418, 'I\'m a teapot'
AUTHENTICATION_TIMEOUT = 419, 'Authentication Timeout'
METHOD_FAILURE = 420, 'Method Failure' # Spring framework
UNPROCESSABLE_ENTITY = 422, 'Unprocessable Entity' UNPROCESSABLE_ENTITY = 422, 'Unprocessable Entity'
LOCKED = 423, 'Locked' LOCKED = 423, 'Locked'
FAILED_DEPENDENCY = 424, 'Failed Dependency' FAILED_DEPENDENCY = 424, 'Failed Dependency'
...@@ -123,16 +111,6 @@ class HTTPStatus(IntEnum): ...@@ -123,16 +111,6 @@ class HTTPStatus(IntEnum):
'Request Header Field Too Large', 'Request Header Field Too Large',
'The server is unwilling to process the request because its header ' 'The server is unwilling to process the request because its header '
'fields are too large') 'fields are too large')
LOGIN_TIMEOUT = 440, 'Login Timeout' # microsoft
NO_RESPONSE = 444, 'No Response' # nginx
RETRY_WITH = 449, 'Retry With' # microsoft
BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS = (450,
'Blocked By Windows Parental Controls') # microsoft
REQUEST_HEADER_TOO_LARGE = 494, 'Request Header Too Large' # nginx
CERT_ERROR = 495, 'Cert Error' # nginx
NO_CERT = 496, 'No Cert' # nginx
HTTP_TO_HTTPS = 497, 'HTTP To HTTPS' # nginx
CLIENT_CLOSED_REQUEST = 499, 'Client Closed Request' # nginx
# server errors # server errors
INTERNAL_SERVER_ERROR = (500, 'Internal Server Error', INTERNAL_SERVER_ERROR = (500, 'Internal Server Error',
...@@ -150,15 +128,7 @@ class HTTPStatus(IntEnum): ...@@ -150,15 +128,7 @@ class HTTPStatus(IntEnum):
VARIANT_ALSO_NEGOTIATES = 506, 'Variant Also Negotiates' VARIANT_ALSO_NEGOTIATES = 506, 'Variant Also Negotiates'
INSUFFICIENT_STORAGE = 507, 'Insufficient Storage' INSUFFICIENT_STORAGE = 507, 'Insufficient Storage'
LOOP_DETECTED = 508, 'Loop Detected' LOOP_DETECTED = 508, 'Loop Detected'
BANDWIDTH_LIMIT_EXCEEDED = 509, 'Bandwidth Limit Exceeded'
NOT_EXTENDED = 510, 'Not Extended' NOT_EXTENDED = 510, 'Not Extended'
NETWORK_AUTHENTICATION_REQUIRED = (511, NETWORK_AUTHENTICATION_REQUIRED = (511,
'Network Authentication Required', 'Network Authentication Required',
'The client needs to authenticate to gain network access') 'The client needs to authenticate to gain network access')
ORIGIN_ERROR = 520, 'Origin Error' # cloudflare
WEB_SERVER_IS_DOWN = 521, 'Web Server Is Down' # cloudflare
CONNECTON_TIMED_OUT = 522, 'Connection Timed Out' # cloudflare
PROXY_DECLINED_REQUEST = 523, 'Proxy Declined Request' # cloudflare
A_TIMEOUT_OCCURRED = 524, 'A Timeout Occurred', '' # cloudflare
NETWORK_READ_TIMEOUT_ERROR = 598, 'Network Read Timeout Error'
NETWORK_CONNECT_TIMEOUT_ERROR = 599, 'Network Connect Timeout Error'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment