Skip to content

Commit 3704171

Browse files
gh-134835: Remove outdated list from howto/urllib2.rst (GH-134844)
🫖
1 parent f58873e commit 3704171

File tree

1 file changed

+19
-67
lines changed

1 file changed

+19
-67
lines changed

Doc/howto/urllib2.rst

Lines changed: 19 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -245,75 +245,27 @@ codes in the 100--299 range indicate success, you will usually only see error
245245
codes in the 400--599 range.
246246

247247
:attr:`http.server.BaseHTTPRequestHandler.responses` is a useful dictionary of
248-
response codes in that shows all the response codes used by :rfc:`2616`. The
249-
dictionary is reproduced here for convenience ::
248+
response codes that shows all the response codes used by :rfc:`2616`.
249+
An excerpt from the dictionary is shown below ::
250250

251-
# Table mapping response codes to messages; entries have the
252-
# form {code: (shortmessage, longmessage)}.
253251
responses = {
254-
100: ('Continue', 'Request received, please continue'),
255-
101: ('Switching Protocols',
256-
'Switching to new protocol; obey Upgrade header'),
257-
258-
200: ('OK', 'Request fulfilled, document follows'),
259-
201: ('Created', 'Document created, URL follows'),
260-
202: ('Accepted',
261-
'Request accepted, processing continues off-line'),
262-
203: ('Non-Authoritative Information', 'Request fulfilled from cache'),
263-
204: ('No Content', 'Request fulfilled, nothing follows'),
264-
205: ('Reset Content', 'Clear input form for further input.'),
265-
206: ('Partial Content', 'Partial content follows.'),
266-
267-
300: ('Multiple Choices',
268-
'Object has several resources -- see URI list'),
269-
301: ('Moved Permanently', 'Object moved permanently -- see URI list'),
270-
302: ('Found', 'Object moved temporarily -- see URI list'),
271-
303: ('See Other', 'Object moved -- see Method and URL list'),
272-
304: ('Not Modified',
273-
'Document has not changed since given time'),
274-
305: ('Use Proxy',
275-
'You must use proxy specified in Location to access this '
276-
'resource.'),
277-
307: ('Temporary Redirect',
278-
'Object moved temporarily -- see URI list'),
279-
280-
400: ('Bad Request',
281-
'Bad request syntax or unsupported method'),
282-
401: ('Unauthorized',
283-
'No permission -- see authorization schemes'),
284-
402: ('Payment Required',
285-
'No payment -- see charging schemes'),
286-
403: ('Forbidden',
287-
'Request forbidden -- authorization will not help'),
288-
404: ('Not Found', 'Nothing matches the given URI'),
289-
405: ('Method Not Allowed',
290-
'Specified method is invalid for this server.'),
291-
406: ('Not Acceptable', 'URI not available in preferred format.'),
292-
407: ('Proxy Authentication Required', 'You must authenticate with '
293-
'this proxy before proceeding.'),
294-
408: ('Request Timeout', 'Request timed out; try again later.'),
295-
409: ('Conflict', 'Request conflict.'),
296-
410: ('Gone',
297-
'URI no longer exists and has been permanently removed.'),
298-
411: ('Length Required', 'Client must specify Content-Length.'),
299-
412: ('Precondition Failed', 'Precondition in headers is false.'),
300-
413: ('Request Entity Too Large', 'Entity is too large.'),
301-
414: ('Request-URI Too Long', 'URI is too long.'),
302-
415: ('Unsupported Media Type', 'Entity body in unsupported format.'),
303-
416: ('Requested Range Not Satisfiable',
304-
'Cannot satisfy request range.'),
305-
417: ('Expectation Failed',
306-
'Expect condition could not be satisfied.'),
307-
308-
500: ('Internal Server Error', 'Server got itself in trouble'),
309-
501: ('Not Implemented',
310-
'Server does not support this operation'),
311-
502: ('Bad Gateway', 'Invalid responses from another server/proxy.'),
312-
503: ('Service Unavailable',
313-
'The server cannot process the request due to a high load'),
314-
504: ('Gateway Timeout',
315-
'The gateway server did not receive a timely response'),
316-
505: ('HTTP Version Not Supported', 'Cannot fulfill request.'),
252+
...
253+
<HTTPStatus.OK: 200>: ('OK', 'Request fulfilled, document follows'),
254+
...
255+
<HTTPStatus.FORBIDDEN: 403>: ('Forbidden',
256+
'Request forbidden -- authorization will '
257+
'not help'),
258+
<HTTPStatus.NOT_FOUND: 404>: ('Not Found',
259+
'Nothing matches the given URI'),
260+
...
261+
<HTTPStatus.IM_A_TEAPOT: 418>: ("I'm a Teapot",
262+
'Server refuses to brew coffee because '
263+
'it is a teapot'),
264+
...
265+
<HTTPStatus.SERVICE_UNAVAILABLE: 503>: ('Service Unavailable',
266+
'The server cannot process the '
267+
'request due to a high load'),
268+
...
317269
}
318270

319271
When an error is raised the server responds by returning an HTTP error code

0 commit comments

Comments
 (0)