Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 61ac612

Browse filesBrowse files
authored
bpo-39507: Add HTTP status 418 "I'm a Teapot" (GH-18291)
1 parent 9023581 commit 61ac612
Copy full SHA for 61ac612

File tree

5 files changed

+9
-3
lines changed
Filter options

5 files changed

+9
-3
lines changed

‎Doc/library/http.rst

Copy file name to clipboardExpand all lines: Doc/library/http.rst
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ Code Enum Name Details
9999
``415`` ``UNSUPPORTED_MEDIA_TYPE`` HTTP/1.1 :rfc:`7231`, Section 6.5.13
100100
``416`` ``REQUESTED_RANGE_NOT_SATISFIABLE`` HTTP/1.1 Range Requests :rfc:`7233`, Section 4.4
101101
``417`` ``EXPECTATION_FAILED`` HTTP/1.1 :rfc:`7231`, Section 6.5.14
102+
``418`` ``IM_A_TEAPOT`` HTCPCP/1.0 :rfc:`2324`, Section 2.3.2
102103
``421`` ``MISDIRECTED_REQUEST`` HTTP/2 :rfc:`7540`, Section 9.1.2
103104
``422`` ``UNPROCESSABLE_ENTITY`` WebDAV :rfc:`4918`, Section 11.2
104105
``423`` ``LOCKED`` WebDAV :rfc:`4918`, Section 11.3
@@ -134,4 +135,4 @@ equal to the constant name (i.e. ``http.HTTPStatus.OK`` is also available as
134135
Added ``451 UNAVAILABLE_FOR_LEGAL_REASONS`` status code.
135136

136137
.. versionadded:: 3.9
137-
Added ``103 EARLY_HINTS`` and ``425 TOO_EARLY`` status codes.
138+
Added ``103 EARLY_HINTS``, ``418 IM_A_TEAPOT`` and ``425 TOO_EARLY`` status codes.

‎Doc/whatsnew/3.9.rst

Copy file name to clipboardExpand all lines: Doc/whatsnew/3.9.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ finalized by the garbage collector. (Contributed by Pablo Galindo in
235235
http
236236
----
237237

238-
HTTP status codes ``103 EARLY_HINTS`` and ``425 TOO_EARLY`` are added to
239-
:class:`http.HTTPStatus`. (Contributed by Dong-hee Na in :issue:`39509`.)
238+
HTTP status codes ``103 EARLY_HINTS``, ``418 IM_A_TEAPOT`` and ``425 TOO_EARLY`` are added to
239+
:class:`http.HTTPStatus`. (Contributed by Dong-hee Na in :issue:`39509` and Ross Rhodes in :issue:`39507`.)
240240

241241
imaplib
242242
-------

‎Lib/http/__init__.py

Copy file name to clipboardExpand all lines: Lib/http/__init__.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class HTTPStatus(IntEnum):
1717
* RFC 2774: An HTTP Extension Framework
1818
* RFC 7725: An HTTP Status Code to Report Legal Obstacles
1919
* RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2)
20+
* RFC 2324: Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)
2021
* RFC 8297: An HTTP Status Code for Indicating Hints
2122
* RFC 8470: Using Early Data in HTTP
2223
"""
@@ -103,6 +104,8 @@ def __new__(cls, value, phrase, description=''):
103104
'Cannot satisfy request range')
104105
EXPECTATION_FAILED = (417, 'Expectation Failed',
105106
'Expect condition could not be satisfied')
107+
IM_A_TEAPOT = (418, 'I\'m a Teapot',
108+
'Server refuses to brew coffee because it is a teapot.')
106109
MISDIRECTED_REQUEST = (421, 'Misdirected Request',
107110
'Server is not able to produce a response')
108111
UNPROCESSABLE_ENTITY = 422, 'Unprocessable Entity'

‎Lib/test/test_httplib.py

Copy file name to clipboardExpand all lines: Lib/test/test_httplib.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,7 @@ def test_client_constants(self):
14331433
'UNSUPPORTED_MEDIA_TYPE',
14341434
'REQUESTED_RANGE_NOT_SATISFIABLE',
14351435
'EXPECTATION_FAILED',
1436+
'IM_A_TEAPOT',
14361437
'MISDIRECTED_REQUEST',
14371438
'UNPROCESSABLE_ENTITY',
14381439
'LOCKED',
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adding HTTP status 418 "I'm a Teapot" to HTTPStatus in http library. Patch by Ross Rhodes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.