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 }
