Skip to content
Myr

status_codes lookup dict

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 6cead64 · Browse files · 1 file+74 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+74 added−0 removed

  • other:+74 added−0 removed

1 file+74 added−0 removed

added:requests/status_codes.py+74 added
1# -*- coding: utf-8 -*-23from .structures import LookupDict45_codes = {6 100: ('continue',),7 101: ('switching_protocols',),8 102: ('processing',),9 103: ('checkpoint',),10 122: ('uri_too_long', 'request_uri_too_long'),11 200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\o/'),12 201: ('created',),13 202: ('accepted',),14 203: ('non_authoritative_info', 'non_authoritative_information'),15 204: ('no_content',),16 205: ('reset_content', 'reset'),17 206: ('partial_content', 'partial'),18 207: ('multi_status', 'multiple_status', 'multi_stati', 'multiple_stati'),19 208: ('im_used',),20 300: ('multiple_choices',),21 301: ('moved_pemanently', 'moved'),22 302: ('found',),23 302: ('see_other', 'other'),24 304: ('not_modified',),25 305: ('use_proxy',),26 306: ('switch_proxy',),27 307: ('temporary_redirect', 'temporary_moved', 'temporary'),28 308: ('resume_incomplete', 'resume'),29 400: ('bad_request', 'bad'),30 401: ('unauthorized',),31 402: ('payment_required', 'payment'),32 403: ('forbidden',),33 404: ('not_found',),34 405: ('method_not_allowed', 'not_allowed'),35 406: ('not_acceptable',),36 407: ('proxy_authentication_required', 'proxy_auth', 'proxy_authentication'),37 408: ('request_timeout', 'timeout'),38 409: ('conflict',),39 410: ('gone',),40 411: ('length_required',),41 412: ('precondition_failed', 'precondition'),42 413: ('request_entity_too_large',),43 414: ('request_uri_too_large',),44 415: ('unspported_media_type', 'unspported_media', 'media_type'),45 416: ('requested_range_not_satisfiable', 'requested_range', 'range_not_satisfiable'),46 417: ('expectation_failed',),47 418: ('im_a_teapot', 'teapot', 'i_am_a_teapot'),48 422: ('unprocessable_entity', 'unprocessable'),49 423: ('locked',),50 424: ('failed_depdendency', 'depdendency'),51 425: ('unordered_collection', 'unordered'),52 426: ('upgrade_required', 'upgrade'),53 444: ('no_response', 'none'),54 449: ('retry_with', 'retry'),55 450: ('blocked_by_windows_parental_controls', 'parental_controls'),56 499: ('client_closed_request',),57 500: ('iternal_server_error', 'server_error'),58 501: ('not_implemented',),59 502: ('bad_gateway',),60 503: ('service_unavailable', 'unavailable'),61 504: ('gateway_timeout',),62 505: ('http_version_not_supported', 'http_version'),63 506: ('variant_also_negotiates',),64 507: ('insufficient_storage',),65 509: ('bandwidth_limit_exceeded', 'bandwidth'),66 510: ('not_extended',),67}6869codes = LookupDict(name='status_codes')7071for (code, titles) in _codes.items():72 for title in titles:73 setattr(codes, title, code)74 setattr(codes, title.upper(), code)