OLD | NEW |
| (Empty) |
1 # -*- coding: utf-8 -*- | |
2 | |
3 from .structures import LookupDict | |
4 | |
5 _codes = { | |
6 | |
7 # Informational. | |
8 100: ('continue',), | |
9 101: ('switching_protocols',), | |
10 102: ('processing',), | |
11 103: ('checkpoint',), | |
12 122: ('uri_too_long', 'request_uri_too_long'), | |
13 200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/', '✓'), | |
14 201: ('created',), | |
15 202: ('accepted',), | |
16 203: ('non_authoritative_info', 'non_authoritative_information'), | |
17 204: ('no_content',), | |
18 205: ('reset_content', 'reset'), | |
19 206: ('partial_content', 'partial'), | |
20 207: ('multi_status', 'multiple_status', 'multi_stati', 'multiple_stati'), | |
21 208: ('already_reported',), | |
22 226: ('im_used',), | |
23 | |
24 # Redirection. | |
25 300: ('multiple_choices',), | |
26 301: ('moved_permanently', 'moved', '\\o-'), | |
27 302: ('found',), | |
28 303: ('see_other', 'other'), | |
29 304: ('not_modified',), | |
30 305: ('use_proxy',), | |
31 306: ('switch_proxy',), | |
32 307: ('temporary_redirect', 'temporary_moved', 'temporary'), | |
33 308: ('resume_incomplete', 'resume'), | |
34 | |
35 # Client Error. | |
36 400: ('bad_request', 'bad'), | |
37 401: ('unauthorized',), | |
38 402: ('payment_required', 'payment'), | |
39 403: ('forbidden',), | |
40 404: ('not_found', '-o-'), | |
41 405: ('method_not_allowed', 'not_allowed'), | |
42 406: ('not_acceptable',), | |
43 407: ('proxy_authentication_required', 'proxy_auth', 'proxy_authentication')
, | |
44 408: ('request_timeout', 'timeout'), | |
45 409: ('conflict',), | |
46 410: ('gone',), | |
47 411: ('length_required',), | |
48 412: ('precondition_failed', 'precondition'), | |
49 413: ('request_entity_too_large',), | |
50 414: ('request_uri_too_large',), | |
51 415: ('unsupported_media_type', 'unsupported_media', 'media_type'), | |
52 416: ('requested_range_not_satisfiable', 'requested_range', 'range_not_satis
fiable'), | |
53 417: ('expectation_failed',), | |
54 418: ('im_a_teapot', 'teapot', 'i_am_a_teapot'), | |
55 422: ('unprocessable_entity', 'unprocessable'), | |
56 423: ('locked',), | |
57 424: ('failed_dependency', 'dependency'), | |
58 425: ('unordered_collection', 'unordered'), | |
59 426: ('upgrade_required', 'upgrade'), | |
60 428: ('precondition_required', 'precondition'), | |
61 429: ('too_many_requests', 'too_many'), | |
62 431: ('header_fields_too_large', 'fields_too_large'), | |
63 444: ('no_response', 'none'), | |
64 449: ('retry_with', 'retry'), | |
65 450: ('blocked_by_windows_parental_controls', 'parental_controls'), | |
66 451: ('unavailable_for_legal_reasons', 'legal_reasons'), | |
67 499: ('client_closed_request',), | |
68 | |
69 # Server Error. | |
70 500: ('internal_server_error', 'server_error', '/o\\', '✗'), | |
71 501: ('not_implemented',), | |
72 502: ('bad_gateway',), | |
73 503: ('service_unavailable', 'unavailable'), | |
74 504: ('gateway_timeout',), | |
75 505: ('http_version_not_supported', 'http_version'), | |
76 506: ('variant_also_negotiates',), | |
77 507: ('insufficient_storage',), | |
78 509: ('bandwidth_limit_exceeded', 'bandwidth'), | |
79 510: ('not_extended',), | |
80 } | |
81 | |
82 codes = LookupDict(name='status_codes') | |
83 | |
84 for (code, titles) in list(_codes.items()): | |
85 for title in titles: | |
86 setattr(codes, title, code) | |
87 if not title.startswith('\\'): | |
88 setattr(codes, title.upper(), code) | |
OLD | NEW |