requests.status_codes
1 codes = {
2
3 # Informational.
4 100: ('continue',),
5 101: ('switching_protocols',),
6 102: ('processing',),
7 103: ('checkpoint',),
8 122: ('uri_too_long', 'request_uri_too_long'),
9 200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/', '?'),
10 201: ('created',),
11 202: ('accepted',),
12 203: ('non_authoritative_info', 'non_authoritative_information'),
13 204: ('no_content',),
14 205: ('reset_content', 'reset'),
15 206: ('partial_content', 'partial'),
16 207: ('multi_status', 'multiple_status', 'multi_stati', 'multiple_stati'),
17 208: ('already_reported',),
18 226: ('im_used',),
19
20 # Redirection.
21 300: ('multiple_choices',),
22 301: ('moved_permanently', 'moved', '\\o-'),
23 302: ('found',),
24 303: ('see_other', 'other'),
25 304: ('not_modified',),
26 305: ('use_proxy',),
27 306: ('switch_proxy',),
28 307: ('temporary_redirect', 'temporary_moved', 'temporary'),
29 308: ('permanent_redirect',
30 'resume_incomplete', 'resume',), # These 2 to be removed in 3.0
31
32 # Client Error.
33 400: ('bad_request', 'bad'),
34 401: ('unauthorized',),
35 402: ('payment_required', 'payment'),
36 403: ('forbidden',),
37 404: ('not_found', '-o-'),
38 405: ('method_not_allowed', 'not_allowed'),
39 406: ('not_acceptable',),
40 407: ('proxy_authentication_required', 'proxy_auth', 'proxy_authentication'),
41 408: ('request_timeout', 'timeout'),
42 409: ('conflict',),
43 410: ('gone',),
44 411: ('length_required',),
45 412: ('precondition_failed', 'precondition'),
46 413: ('request_entity_too_large',),
47 414: ('request_uri_too_large',),
48 415: ('unsupported_media_type', 'unsupported_media', 'media_type'),
49 416: ('requested_range_not_satisfiable', 'requested_range', 'range_not_satisfiable'),
50 417: ('expectation_failed',),
51 418: ('im_a_teapot', 'teapot', 'i_am_a_teapot'),
52 421: ('misdirected_request',),
53 422: ('unprocessable_entity', 'unprocessable'),
54 423: ('locked',),
55 424: ('failed_dependency', 'dependency'),
56 425: ('unordered_collection', 'unordered'),
57 426: ('upgrade_required', 'upgrade'),
58 428: ('precondition_required', 'precondition'),
59 429: ('too_many_requests', 'too_many'),
60 431: ('header_fields_too_large', 'fields_too_large'),
61 444: ('no_response', 'none'),
62 449: ('retry_with', 'retry'),
63 450: ('blocked_by_windows_parental_controls', 'parental_controls'),
64 451: ('unavailable_for_legal_reasons', 'legal_reasons'),
65 499: ('client_closed_request',),
66
67 # Server Error.
68 500: ('internal_server_error', 'server_error', '/o\\', '?'),
69 501: ('not_implemented',),
70 502: ('bad_gateway',),
71 503: ('service_unavailable', 'unavailable'),
72 504: ('gateway_timeout',),
73 505: ('http_version_not_supported', 'http_version'),
74 506: ('variant_also_negotiates',),
75 507: ('insufficient_storage',),
76 509: ('bandwidth_limit_exceeded', 'bandwidth'),
77 510: ('not_extended',),
78 511: ('network_authentication_required', 'network_auth', 'network_authentication'),
79 }
1 codes2={
2
3 # 消息
4 # 这一类型的状态码,代表请求已被接受,需要继续处理。
5 100: ('Continue', '继续。客户端应继续其请求'),
6 101: ('Switching Protocols', '切换协议。服务器根据客户端的请求切换协议。只能切换到更高级的协议,例如,切换到HTTP的新版本协议'),
7 102: ('Processing', '处理将被继续执行'),
8 103: ('Early Hints', '提前预加载(css、js)文档,提升用户的访问速度'),
9 122: ('URI Too Long', '请求的URI过长'),
10
11 # 成功
12 # 这一类型的状态码,代表请求已成功被服务器接收、理解、并接受。
13 200: ('OK', '请求成功。一般用于GET与POST请求'),
14 201: ('Created', '已创建。成功请求并创建了新的资源'),
15 202: ('Accepted', '已接受。已经接受请求,但未处理完成'),
16 203: ('Non-Authoritative Information', '非授权信息。请求成功。但返回的meta信息不在原始的服务器,而是一个副本'),
17 204: ('No Content', '无内容。服务器成功处理,但未返回内容。在未更新网页的情况下,可确保浏览器继续显示当前文档'),
18 205: ('Reset Content', '重置内容。服务器处理成功,用户终端(例如:浏览器)应重置文档视图。可通过此返回码清除浏览器的表单域'),
19 206: ('Partial Content', '部分内容。服务器成功处理了部分GET请求'),
20 207: ('Multi-Status', '之后的消息体将是一个XML消息,并且可能依照之前子请求数量的不同,包含一系列独立的响应代码'),
21 208: ('Already Reported', 'DAV绑定的成员已经在(多状态)响应之前的部分被列举,且未被再次包含'),
22 226: ('IM Used', '服务器已经满足了对资源的请求,对实体请求的一个或多个实体操作的结果表示'),
23
24 # 重定向
25 # 这类状态码代表需要客户端采取进一步的操作才能完成请求。
26 300: ('Multiple Choices', '多种选择。请求的资源可包括多个位置,相应可返回一个资源特征与地址的列表用于用户终端(例如:浏览器)选择'),
27 301: ('Moved Permanently', '永久移动。请求的资源已被永久的移动到新URI,返回信息会包括新的URI,浏览器会自动定向到新URI。今后任何新的请求都应使用新的URI代替'),
28 302: ('Found', '临时移动。与301类似。但资源只是临时被移动。客户端应继续使用原有URI'),
29 303: ('See Other', '查看其它地址。与301类似。使用GET和POST请求查看'),
30 304: ('Not Modified', '未修改。所请求的资源未修改,服务器返回此状态码时,不会返回任何资源。客户端通常会缓存访问过的资源,通过提供一个头信息指出客户端希望只返回在指定日期之后修改的资源'),
31 305: ('Use Proxy', '使用代理。所请求的资源必须通过代理访问'),
32 306: ('Unused', '已经被废弃的HTTP状态码'),
33 307: ('Temporary Redirect', '临时重定向。与302类似。使用GET请求重定向'),
34 308: ('Permanent Redirect', '请求和所有将来的请求应该使用另一个URI重复'),
35
36 # 请求错误
37 # 这类的状态码代表了客户端看起来可能发生了错误,妨碍了服务器的处理。
38 400: ('Bad Request', '客户端请求的语法错误,服务器无法理解'),
39 401: ('Unauthorized', '请求要求用户的身份认证'),
40 402: ('Payment Required', '保留,将来使用'),
41 403: ('Forbidden', '服务器理解请求客户端的请求,但是拒绝执行此请求'),
42 404: ('Not Found', '服务器无法根据客户端的请求找到资源(网页)。通过此代码,网站设计人员可设置"您所请求的资源无法找到"的个性页面'),
43 405: ('Method Not Allowed', '客户端请求中的方法被禁止'),
44 406: ('Not Acceptable', '服务器无法根据客户端请求的内容特性完成请求'),
45 407: ('Proxy Authentication Required', '请求要求代理的身份认证,与401类似,但请求者应当使用代理进行授权'),
46 408: ('Request Time-out', '服务器等待客户端发送的请求时间过长,超时'),
47 409: ('Conflict', '服务器完成客户端的PUT请求是可能返回此代码,服务器处理请求时发生了冲突'),
48 410: ('Gone', '客户端请求的资源已经不存在。410不同于404,如果资源以前有现在被永久删除了可使用410代码,网站设计人员可通过301代码指定资源的新位置'),
49 411: ('Length Required', '服务器无法处理客户端发送的不带Content-Length的请求信息'),
50 412: ('Precondition Failed', '客户端请求信息的先决条件错误'),
51 413: ('Request Entity Too Large', '由于请求的实体过大,服务器无法处理,因此拒绝请求。为防止客户端的连续请求,服务器可能会关闭连接'),
52 414: ('Request-URI Too Large', '请求的URI过长(URI通常为网址),服务器无法处理'),
53 415: ('Unsupported Media Type', '服务器无法处理请求附带的媒体格式'),
54 416: ('Requested range not satisfiable', '客户端请求的范围无效'),
55 417: ('Expectation Failed', '服务器无法满足Expect的请求头信息'),
56 418: ("I'm a teapot", '客户端错误响应代码表示服务器拒绝冲泡咖啡'),
57 421: ('Misdirected Request', '请求被指向到无法生成响应的服务器(比如由于连接重复使用)'),
58 422: ('Unprocessable Entity', '请求格式正确,但是由于含有语义错误,无法响应'),
59 423: ('Locked', '当前资源被锁定'),
60 424: ('Failed Dependency', '由于之前的某个请求发生的错误,导致当前请求失败,例如 PROPPATCH'),
61 425: ('Too Early', '服务器不愿意冒风险来处理该请求,原因是处理该请求可能会被“重放”,从而造成潜在的重放攻击'),
62 426: ('Upgrade Required', '客户端应当切换到TLS/1.0'),
63 428: ('Precondition Required', '客户端必须发送上述的请求头才能执行请求'),
64 429: ('Too Many Requests', '太多请求'),
65 431: ('Request Header Fields Too Large', '请求头字段太大'),
66 444: ('No Response', '服务器不向客户端返回任何信息,并关闭连接(有助于阻止恶意软件)'),
67 449: ('Retry With', '请求应当在执行完适当的操作后进行重试'),
68 450: ('Blocked by Windows Parental Controls', '这是一个由Windows家庭控制(Microsoft)HTTP阻止的450状态代码的示例,用于信息和测试'),
69 451: ('Unavailable For Legal Reasons', '该请求因法律原因不可用'),
70 499: ('Token Required', '验证信息错误还是会回传 401 Unathorized'),
71
72 # 服务器错误
73 # 这类状态码代表了服务器在处理请求的过程中有错误或者异常状态发生,也有可能是服务器意识到以当前的软硬件资源无法完成对请求的处理。
74 500: ('Internal Server Error', '服务器内部错误,无法完成请求'),
75 501: ('Not Implemented', '服务器不支持请求的功能,无法完成请求'),
76 502: ('Bad Gateway', '作为网关或者代理工作的服务器尝试执行请求时,从远程服务器接收到了一个无效的响应'),
77 503: ('Service Unavailable', '由于超载或系统维护,服务器暂时的无法处理客户端的请求。延时的长度可包含在服务器的Retry-After头信息中'),
78 504: ('Gateway Time-out', '充当网关或代理的服务器,未及时从远端服务器获取请求'),
79 505: ('HTTP Version not supported', '服务器不支持请求的HTTP协议的版本,无法完成处理'),
80 506: ('Variant Also Negotiates', '服务器存在内部配置错误:被请求的协商变元资源被配置为在透明内容协商中使用自己,因此在一个协商处理中不是一个合适的重点'),
81 507: ('Insufficient Storage', '服务器无法存储完成请求所必须的内容'),
82 509: ('Bandwidth Limit Exceeded', '服务器达到带宽限制'),
83 510: ('Not Extended', '获取资源所需要的策略并没有被满足'),
84 511: ('Network Authentication Required', '客户端需要进行身份验证才能获得网络访问权限,旨在限制用户群访问特定网络。(例如连接WiFi热点时的强制网络门户)'),
85 }