| 1 |
|
| 2 |
|
| 3 |
from .structures import LookupDict |
| 4 |
|
| 5 |
_codes = { |
| 6 |
|
| 7 |
|
| 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: ('im_used',), |
| 22 |
|
| 23 |
|
| 24 |
300: ('multiple_choices',), |
| 25 |
301: ('moved_permanently', 'moved', '\\o-'), |
| 26 |
302: ('found',), |
| 27 |
303: ('see_other', 'other'), |
| 28 |
304: ('not_modified',), |
| 29 |
305: ('use_proxy',), |
| 30 |
306: ('switch_proxy',), |
| 31 |
307: ('temporary_redirect', 'temporary_moved', 'temporary'), |
| 32 |
308: ('resume_incomplete', 'resume'), |
| 33 |
|
| 34 |
|
| 35 |
400: ('bad_request', 'bad'), |
| 36 |
401: ('unauthorized',), |
| 37 |
402: ('payment_required', 'payment'), |
| 38 |
403: ('forbidden',), |
| 39 |
404: ('not_found', '-o-'), |
| 40 |
405: ('method_not_allowed', 'not_allowed'), |
| 41 |
406: ('not_acceptable',), |
| 42 |
407: ('proxy_authentication_required', 'proxy_auth', 'proxy_authentication'), |
| 43 |
408: ('request_timeout', 'timeout'), |
| 44 |
409: ('conflict',), |
| 45 |
410: ('gone',), |
| 46 |
411: ('length_required',), |
| 47 |
412: ('precondition_failed', 'precondition'), |
| 48 |
413: ('request_entity_too_large',), |
| 49 |
414: ('request_uri_too_large',), |
| 50 |
415: ('unsupported_media_type', 'unsupported_media', 'media_type'), |
| 51 |
416: ('requested_range_not_satisfiable', 'requested_range', 'range_not_satisfiable'), |
| 52 |
417: ('expectation_failed',), |
| 53 |
418: ('im_a_teapot', 'teapot', 'i_am_a_teapot'), |
| 54 |
422: ('unprocessable_entity', 'unprocessable'), |
| 55 |
423: ('locked',), |
| 56 |
424: ('failed_dependency', 'dependency'), |
| 57 |
425: ('unordered_collection', 'unordered'), |
| 58 |
426: ('upgrade_required', 'upgrade'), |
| 59 |
428: ('precondition_required', 'precondition'), |
| 60 |
429: ('too_many_requests', 'too_many'), |
| 61 |
431: ('header_fields_too_large', 'fields_too_large'), |
| 62 |
444: ('no_response', 'none'), |
| 63 |
449: ('retry_with', 'retry'), |
| 64 |
450: ('blocked_by_windows_parental_controls', 'parental_controls'), |
| 65 |
499: ('client_closed_request',), |
| 66 |
|
| 67 |
|
| 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 |
} |
| 79 |
|
| 80 |
codes = LookupDict(name='status_codes') |
| 81 |
|
| 82 |
for (code, titles) in list(_codes.items()): |
| 83 |
for title in titles: |
| 84 |
setattr(codes, title, code) |
| 85 |
if not title.startswith('\\'): |
| 86 |
setattr(codes, title.upper(), code) |