Skip to content

Instantly share code, notes, and snippets.

@kevinsqi
Created June 23, 2017 18:10
Show Gist options
  • Save kevinsqi/f649a576e34ad6b8b21e2e328f1abecd to your computer and use it in GitHub Desktop.
Save kevinsqi/f649a576e34ad6b8b21e2e328f1abecd to your computer and use it in GitHub Desktop.
Python requests.codes.* error code names
>>> import requests
>>> vars(requests.codes)
{'-O-': 404,
'-o-': 404,
'/O\\': 500,
'/o\\': 500,
'ACCEPTED': 202,
'ALL_GOOD': 200,
'ALL_OK': 200,
'ALL_OKAY': 200,
'ALREADY_REPORTED': 208,
'BAD': 400,
'BAD_GATEWAY': 502,
'BAD_REQUEST': 400,
'BANDWIDTH': 509,
'BANDWIDTH_LIMIT_EXCEEDED': 509,
'BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS': 450,
'CHECKPOINT': 103,
'CLIENT_CLOSED_REQUEST': 499,
'CONFLICT': 409,
'CONTINUE': 100,
'CREATED': 201,
'DEPENDENCY': 424,
'EXPECTATION_FAILED': 417,
'FAILED_DEPENDENCY': 424,
'FIELDS_TOO_LARGE': 431,
'FORBIDDEN': 403,
'FOUND': 302,
'GATEWAY_TIMEOUT': 504,
'GONE': 410,
'HEADER_FIELDS_TOO_LARGE': 431,
'HTTP_VERSION': 505,
'HTTP_VERSION_NOT_SUPPORTED': 505,
'IM_A_TEAPOT': 418,
'IM_USED': 226,
'INSUFFICIENT_STORAGE': 507,
'INTERNAL_SERVER_ERROR': 500,
'I_AM_A_TEAPOT': 418,
'LEGAL_REASONS': 451,
'LENGTH_REQUIRED': 411,
'LOCKED': 423,
'MEDIA_TYPE': 415,
'METHOD_NOT_ALLOWED': 405,
'MOVED': 301,
'MOVED_PERMANENTLY': 301,
'MULTIPLE_CHOICES': 300,
'MULTIPLE_STATI': 207,
'MULTIPLE_STATUS': 207,
'MULTI_STATI': 207,
'MULTI_STATUS': 207,
'NETWORK_AUTH': 511,
'NETWORK_AUTHENTICATION': 511,
'NETWORK_AUTHENTICATION_REQUIRED': 511,
'NONE': 444,
'NON_AUTHORITATIVE_INFO': 203,
'NON_AUTHORITATIVE_INFORMATION': 203,
'NOT_ACCEPTABLE': 406,
'NOT_ALLOWED': 405,
'NOT_EXTENDED': 510,
'NOT_FOUND': 404,
'NOT_IMPLEMENTED': 501,
'NOT_MODIFIED': 304,
'NO_CONTENT': 204,
'NO_RESPONSE': 444,
'OK': 200,
'OKAY': 200,
'OTHER': 303,
'PARENTAL_CONTROLS': 450,
'PARTIAL': 206,
'PARTIAL_CONTENT': 206,
'PAYMENT': 402,
'PAYMENT_REQUIRED': 402,
'PERMANENT_REDIRECT': 308,
'PRECONDITION': 412,
'PRECONDITION_FAILED': 412,
'PRECONDITION_REQUIRED': 428,
'PROCESSING': 102,
'PROXY_AUTH': 407,
'PROXY_AUTHENTICATION': 407,
'PROXY_AUTHENTICATION_REQUIRED': 407,
'RANGE_NOT_SATISFIABLE': 416,
'REQUESTED_RANGE': 416,
'REQUESTED_RANGE_NOT_SATISFIABLE': 416,
'REQUEST_ENTITY_TOO_LARGE': 413,
'REQUEST_TIMEOUT': 408,
'REQUEST_URI_TOO_LARGE': 414,
'REQUEST_URI_TOO_LONG': 122,
'RESET': 205,
'RESET_CONTENT': 205,
'RESUME': 308,
'RESUME_INCOMPLETE': 308,
'RETRY': 449,
'RETRY_WITH': 449,
'SEE_OTHER': 303,
'SERVER_ERROR': 500,
'SERVICE_UNAVAILABLE': 503,
'SWITCHING_PROTOCOLS': 101,
'SWITCH_PROXY': 306,
'TEAPOT': 418,
'TEMPORARY': 307,
'TEMPORARY_MOVED': 307,
'TEMPORARY_REDIRECT': 307,
'TIMEOUT': 408,
'TOO_MANY': 429,
'TOO_MANY_REQUESTS': 429,
'UNAUTHORIZED': 401,
'UNAVAILABLE': 503,
'UNAVAILABLE_FOR_LEGAL_REASONS': 451,
'UNORDERED': 425,
'UNORDERED_COLLECTION': 425,
'UNPROCESSABLE': 422,
'UNPROCESSABLE_ENTITY': 422,
'UNSUPPORTED_MEDIA': 415,
'UNSUPPORTED_MEDIA_TYPE': 415,
'UPGRADE': 426,
'UPGRADE_REQUIRED': 426,
'URI_TOO_LONG': 122,
'USE_PROXY': 305,
'VARIANT_ALSO_NEGOTIATES': 506,
'\\o-': 301,
'\\o/': 200,
'accepted': 202,
'all_good': 200,
'all_ok': 200,
'all_okay': 200,
'already_reported': 208,
'bad': 400,
'bad_gateway': 502,
'bad_request': 400,
'bandwidth': 509,
'bandwidth_limit_exceeded': 509,
'blocked_by_windows_parental_controls': 450,
'checkpoint': 103,
'client_closed_request': 499,
'conflict': 409,
'continue': 100,
'created': 201,
'dependency': 424,
'expectation_failed': 417,
'failed_dependency': 424,
'fields_too_large': 431,
'forbidden': 403,
'found': 302,
'gateway_timeout': 504,
'gone': 410,
'header_fields_too_large': 431,
'http_version': 505,
'http_version_not_supported': 505,
'i_am_a_teapot': 418,
'im_a_teapot': 418,
'im_used': 226,
'insufficient_storage': 507,
'internal_server_error': 500,
'legal_reasons': 451,
'length_required': 411,
'locked': 423,
'media_type': 415,
'method_not_allowed': 405,
'moved': 301,
'moved_permanently': 301,
'multi_stati': 207,
'multi_status': 207,
'multiple_choices': 300,
'multiple_stati': 207,
'multiple_status': 207,
'name': 'status_codes',
'network_auth': 511,
'network_authentication': 511,
'network_authentication_required': 511,
'no_content': 204,
'no_response': 444,
'non_authoritative_info': 203,
'non_authoritative_information': 203,
'none': 444,
'not_acceptable': 406,
'not_allowed': 405,
'not_extended': 510,
'not_found': 404,
'not_implemented': 501,
'not_modified': 304,
'ok': 200,
'okay': 200,
'other': 303,
'parental_controls': 450,
'partial': 206,
'partial_content': 206,
'payment': 402,
'payment_required': 402,
'permanent_redirect': 308,
'precondition': 412,
'precondition_failed': 412,
'precondition_required': 428,
'processing': 102,
'proxy_auth': 407,
'proxy_authentication': 407,
'proxy_authentication_required': 407,
'range_not_satisfiable': 416,
'request_entity_too_large': 413,
'request_timeout': 408,
'request_uri_too_large': 414,
'request_uri_too_long': 122,
'requested_range': 416,
'requested_range_not_satisfiable': 416,
'reset': 205,
'reset_content': 205,
'resume': 308,
'resume_incomplete': 308,
'retry': 449,
'retry_with': 449,
'see_other': 303,
'server_error': 500,
'service_unavailable': 503,
'switch_proxy': 306,
'switching_protocols': 101,
'teapot': 418,
'temporary': 307,
'temporary_moved': 307,
'temporary_redirect': 307,
'timeout': 408,
'too_many': 429,
'too_many_requests': 429,
'unauthorized': 401,
'unavailable': 503,
'unavailable_for_legal_reasons': 451,
'unordered': 425,
'unordered_collection': 425,
'unprocessable': 422,
'unprocessable_entity': 422,
'unsupported_media': 415,
'unsupported_media_type': 415,
'upgrade': 426,
'upgrade_required': 426,
'uri_too_long': 122,
'use_proxy': 305,
'variant_also_negotiates': 506,
'\xe2\x9c\x93': 200,
'\xe2\x9c\x97': 500}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment