Skip to content

gh-134835: Remove outdated list from howto/urllib2.rst #134844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

StanFromIreland
Copy link
Contributor

@StanFromIreland StanFromIreland commented May 28, 2025

The table is very different from what is returned now, and there is little point in updating it. Current return value for reference:

{
<HTTPStatus.CONTINUE: 100>: ('Continue', 'Request received, please continue'), 
<HTTPStatus.SWITCHING_PROTOCOLS: 101>: ('Switching Protocols', 'Switching to new protocol; obey Upgrade header'), 
<HTTPStatus.PROCESSING: 102>: ('Processing', 'Server is processing the request'), 
<HTTPStatus.EARLY_HINTS: 103>: ('Early Hints', 'Headers sent to prepare for the response'), 

<HTTPStatus.OK: 200>: ('OK', 'Request fulfilled, document follows'), 
<HTTPStatus.CREATED: 201>: ('Created', 'Document created, URL follows'), 
<HTTPStatus.ACCEPTED: 202>: ('Accepted', 'Request accepted, processing continues off-line'), 
<HTTPStatus.NON_AUTHORITATIVE_INFORMATION: 203>: ('Non-Authoritative Information', 'Request fulfilled from cache'), 
<HTTPStatus.NO_CONTENT: 204>: ('No Content', 'Request fulfilled, nothing follows'), 
<HTTPStatus.RESET_CONTENT: 205>: ('Reset Content', 'Clear input form for further input'), 
<HTTPStatus.PARTIAL_CONTENT: 206>: ('Partial Content', 'Partial content follows'), 
<HTTPStatus.MULTI_STATUS: 207>: ('Multi-Status', 'Response contains multiple statuses in the body'), 
<HTTPStatus.ALREADY_REPORTED: 208>: ('Already Reported', 'Operation has already been reported'), 
<HTTPStatus.IM_USED: 226>: ('IM Used', 'Request completed using instance manipulations'), 

<HTTPStatus.MULTIPLE_CHOICES: 300>: ('Multiple Choices', 'Object has several resources -- see URI list'), 
<HTTPStatus.MOVED_PERMANENTLY: 301>: ('Moved Permanently', 'Object moved permanently -- see URI list'), 
<HTTPStatus.FOUND: 302>: ('Found', 'Object moved temporarily -- see URI list'), 
<HTTPStatus.SEE_OTHER: 303>: ('See Other', 'Object moved -- see Method and URL list'), 
<HTTPStatus.NOT_MODIFIED: 304>: ('Not Modified', 'Document has not changed since given time'), 
<HTTPStatus.USE_PROXY: 305>: ('Use Proxy', 'You must use proxy specified in Location to access this resource'), 
<HTTPStatus.TEMPORARY_REDIRECT: 307>: ('Temporary Redirect', 'Object moved temporarily -- see URI list'), 
<HTTPStatus.PERMANENT_REDIRECT: 308>: ('Permanent Redirect', 'Object moved permanently -- see URI list'), 

<HTTPStatus.BAD_REQUEST: 400>: ('Bad Request', 'Bad request syntax or unsupported method'), 
<HTTPStatus.UNAUTHORIZED: 401>: ('Unauthorized', 'No permission -- see authorization schemes'), 
<HTTPStatus.PAYMENT_REQUIRED: 402>: ('Payment Required', 'No payment -- see charging schemes'), 
<HTTPStatus.FORBIDDEN: 403>: ('Forbidden', 'Request forbidden -- authorization will not help'), 
<HTTPStatus.NOT_FOUND: 404>: ('Not Found', 'Nothing matches the given URI'), 
<HTTPStatus.METHOD_NOT_ALLOWED: 405>: ('Method Not Allowed', 'Specified method is invalid for this resource'), 
<HTTPStatus.NOT_ACCEPTABLE: 406>: ('Not Acceptable', 'URI not available in preferred format'), 
<HTTPStatus.PROXY_AUTHENTICATION_REQUIRED: 407>: ('Proxy Authentication Required', 'You must authenticate with this proxy before proceeding'), 
<HTTPStatus.REQUEST_TIMEOUT: 408>: ('Request Timeout', 'Request timed out; try again later'), 
<HTTPStatus.CONFLICT: 409>: ('Conflict', 'Request conflict'), 
<HTTPStatus.GONE: 410>: ('Gone', 'URI no longer exists and has been permanently removed'), 
<HTTPStatus.LENGTH_REQUIRED: 411>: ('Length Required', 'Client must specify Content-Length'), 
<HTTPStatus.PRECONDITION_FAILED: 412>: ('Precondition Failed', 'Precondition in headers is false'), 
<HTTPStatus.CONTENT_TOO_LARGE: 413>: ('Content Too Large', 'Content is too large'), 
<HTTPStatus.URI_TOO_LONG: 414>: ('URI Too Long', 'URI is too long'), 
<HTTPStatus.UNSUPPORTED_MEDIA_TYPE: 415>: ('Unsupported Media Type', 'Entity body in unsupported format'), 
<HTTPStatus.RANGE_NOT_SATISFIABLE: 416>: ('Range Not Satisfiable', 'Cannot satisfy request range'), 
<HTTPStatus.EXPECTATION_FAILED: 417>: ('Expectation Failed', 'Expect condition could not be satisfied'), 
<HTTPStatus.IM_A_TEAPOT: 418>: ("I'm a Teapot", 'Server refuses to brew coffee because it is a teapot'), 
<HTTPStatus.MISDIRECTED_REQUEST: 421>: ('Misdirected Request', 'Server is not able to produce a response'), 
<HTTPStatus.UNPROCESSABLE_CONTENT: 422>: ('Unprocessable Content', 'Server is not able to process the contained instructions'), 
<HTTPStatus.LOCKED: 423>: ('Locked', 'Resource of a method is locked'), 
<HTTPStatus.FAILED_DEPENDENCY: 424>: ('Failed Dependency', 'Dependent action of the request failed'), 
<HTTPStatus.TOO_EARLY: 425>: ('Too Early', 'Server refuses to process a request that might be replayed'), 
<HTTPStatus.UPGRADE_REQUIRED: 426>: ('Upgrade Required', 'Server refuses to perform the request using the current protocol'), 
<HTTPStatus.PRECONDITION_REQUIRED: 428>: ('Precondition Required', 'The origin server requires the request to be conditional'), 
<HTTPStatus.TOO_MANY_REQUESTS: 429>: ('Too Many Requests', 'The user has sent too many requests in a given amount of time ("rate limiting")'), 
<HTTPStatus.REQUEST_HEADER_FIELDS_TOO_LARGE: 431>: ('Request Header Fields Too Large', 'The server is unwilling to process the request because its header fields are too large'), 
<HTTPStatus.UNAVAILABLE_FOR_LEGAL_REASONS: 451>: ('Unavailable For Legal Reasons', 'The server is denying access to the resource as a consequence of a legal demand'), 

<HTTPStatus.INTERNAL_SERVER_ERROR: 500>: ('Internal Server Error', 'Server got itself in trouble'), 
<HTTPStatus.NOT_IMPLEMENTED: 501>: ('Not Implemented', 'Server does not support this operation'), 
<HTTPStatus.BAD_GATEWAY: 502>: ('Bad Gateway', 'Invalid responses from another server/proxy'), 
<HTTPStatus.SERVICE_UNAVAILABLE: 503>: ('Service Unavailable', 'The server cannot process the request due to a high load'), 
<HTTPStatus.GATEWAY_TIMEOUT: 504>: ('Gateway Timeout', 'The gateway server did not receive a timely response'), 
<HTTPStatus.HTTP_VERSION_NOT_SUPPORTED: 505>: ('HTTP Version Not Supported', 'Cannot fulfill request'), 
<HTTPStatus.VARIANT_ALSO_NEGOTIATES: 506>: ('Variant Also Negotiates', 'Server has an internal configuration error'), 
<HTTPStatus.INSUFFICIENT_STORAGE: 507>: ('Insufficient Storage', 'Server is not able to store the representation'), 
<HTTPStatus.LOOP_DETECTED: 508>: ('Loop Detected', 'Server encountered an infinite loop while processing a request'), 
<HTTPStatus.NOT_EXTENDED: 510>: ('Not Extended', 'Request does not meet the resource access policy'), 
<HTTPStatus.NETWORK_AUTHENTICATION_REQUIRED: 511>: ('Network Authentication Required', 'The client needs to authenticate to gain network access')
}

Also corrected typo in existing line.


📚 Documentation preview 📚: https://cpython-previews--134844.org.readthedocs.build/en/134844/howto/urllib2.html#urllib-howto

'The gateway server did not receive a timely response'),
505: ('HTTP Version Not Supported', 'Cannot fulfill request.'),
}
response codes that shows all the response codes used by :rfc:`2616`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest keeping a minimal example code of what it contains showing the values for 200, 403, 404, and 503.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this? (I added a personal favorite, but I don't mind removing it)

An excerpt from the dictionary is shown below ::

    responses = {
        ...
        <HTTPStatus.OK: 200>: ('OK', 'Request fulfilled, document follows'),
        ...
        <HTTPStatus.FORBIDDEN: 403>: ('Forbidden',
                                      'Request forbidden -- authorization will not help'), 
        <HTTPStatus.NOT_FOUND: 404>: ('Not Found',
                                      'Nothing matches the given URI'),
        ...
        <HTTPStatus.IM_A_TEAPOT: 418>: ("I'm a Teapot",
                                        'Server refuses to brew coffee because it is a teapot'),
        ...
        <HTTPStatus.SERVICE_UNAVAILABLE: 503>: ('Service Unavailable',
                                                'The server cannot process the request due to a high load'),
        ...
        }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great. Love the teapot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants