ยปCore Development>Code coverage>Lib/http/__init__.py

Python code coverage for Lib/http/__init__.py

#countcontent
1n/afrom enum import IntEnum
2n/a
3n/a__all__ = ['HTTPStatus']
4n/a
5n/aclass HTTPStatus(IntEnum):
6n/a """HTTP status codes and reason phrases
7n/a
8n/a Status codes from the following RFCs are all observed:
9n/a
10n/a * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616
11n/a * RFC 6585: Additional HTTP Status Codes
12n/a * RFC 3229: Delta encoding in HTTP
13n/a * RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518
14n/a * RFC 5842: Binding Extensions to WebDAV
15n/a * RFC 7238: Permanent Redirect
16n/a * RFC 2295: Transparent Content Negotiation in HTTP
17n/a * RFC 2774: An HTTP Extension Framework
18n/a """
19n/a def __new__(cls, value, phrase, description=''):
20n/a obj = int.__new__(cls, value)
21n/a obj._value_ = value
22n/a
23n/a obj.phrase = phrase
24n/a obj.description = description
25n/a return obj
26n/a
27n/a # informational
28n/a CONTINUE = 100, 'Continue', 'Request received, please continue'
29n/a SWITCHING_PROTOCOLS = (101, 'Switching Protocols',
30n/a 'Switching to new protocol; obey Upgrade header')
31n/a PROCESSING = 102, 'Processing'
32n/a
33n/a # success
34n/a OK = 200, 'OK', 'Request fulfilled, document follows'
35n/a CREATED = 201, 'Created', 'Document created, URL follows'
36n/a ACCEPTED = (202, 'Accepted',
37n/a 'Request accepted, processing continues off-line')
38n/a NON_AUTHORITATIVE_INFORMATION = (203,
39n/a 'Non-Authoritative Information', 'Request fulfilled from cache')
40n/a NO_CONTENT = 204, 'No Content', 'Request fulfilled, nothing follows'
41n/a RESET_CONTENT = 205, 'Reset Content', 'Clear input form for further input'
42n/a PARTIAL_CONTENT = 206, 'Partial Content', 'Partial content follows'
43n/a MULTI_STATUS = 207, 'Multi-Status'
44n/a ALREADY_REPORTED = 208, 'Already Reported'
45n/a IM_USED = 226, 'IM Used'
46n/a
47n/a # redirection
48n/a MULTIPLE_CHOICES = (300, 'Multiple Choices',
49n/a 'Object has several resources -- see URI list')
50n/a MOVED_PERMANENTLY = (301, 'Moved Permanently',
51n/a 'Object moved permanently -- see URI list')
52n/a FOUND = 302, 'Found', 'Object moved temporarily -- see URI list'
53n/a SEE_OTHER = 303, 'See Other', 'Object moved -- see Method and URL list'
54n/a NOT_MODIFIED = (304, 'Not Modified',
55n/a 'Document has not changed since given time')
56n/a USE_PROXY = (305, 'Use Proxy',
57n/a 'You must use proxy specified in Location to access this resource')
58n/a TEMPORARY_REDIRECT = (307, 'Temporary Redirect',
59n/a 'Object moved temporarily -- see URI list')
60n/a PERMANENT_REDIRECT = (308, 'Permanent Redirect',
61n/a 'Object moved temporarily -- see URI list')
62n/a
63n/a # client error
64n/a BAD_REQUEST = (400, 'Bad Request',
65n/a 'Bad request syntax or unsupported method')
66n/a UNAUTHORIZED = (401, 'Unauthorized',
67n/a 'No permission -- see authorization schemes')
68n/a PAYMENT_REQUIRED = (402, 'Payment Required',
69n/a 'No payment -- see charging schemes')
70n/a FORBIDDEN = (403, 'Forbidden',
71n/a 'Request forbidden -- authorization will not help')
72n/a NOT_FOUND = (404, 'Not Found',
73n/a 'Nothing matches the given URI')
74n/a METHOD_NOT_ALLOWED = (405, 'Method Not Allowed',
75n/a 'Specified method is invalid for this resource')
76n/a NOT_ACCEPTABLE = (406, 'Not Acceptable',
77n/a 'URI not available in preferred format')
78n/a PROXY_AUTHENTICATION_REQUIRED = (407,
79n/a 'Proxy Authentication Required',
80n/a 'You must authenticate with this proxy before proceeding')
81n/a REQUEST_TIMEOUT = (408, 'Request Timeout',
82n/a 'Request timed out; try again later')
83n/a CONFLICT = 409, 'Conflict', 'Request conflict'
84n/a GONE = (410, 'Gone',
85n/a 'URI no longer exists and has been permanently removed')
86n/a LENGTH_REQUIRED = (411, 'Length Required',
87n/a 'Client must specify Content-Length')
88n/a PRECONDITION_FAILED = (412, 'Precondition Failed',
89n/a 'Precondition in headers is false')
90n/a REQUEST_ENTITY_TOO_LARGE = (413, 'Request Entity Too Large',
91n/a 'Entity is too large')
92n/a REQUEST_URI_TOO_LONG = (414, 'Request-URI Too Long',
93n/a 'URI is too long')
94n/a UNSUPPORTED_MEDIA_TYPE = (415, 'Unsupported Media Type',
95n/a 'Entity body in unsupported format')
96n/a REQUESTED_RANGE_NOT_SATISFIABLE = (416,
97n/a 'Requested Range Not Satisfiable',
98n/a 'Cannot satisfy request range')
99n/a EXPECTATION_FAILED = (417, 'Expectation Failed',
100n/a 'Expect condition could not be satisfied')
101n/a UNPROCESSABLE_ENTITY = 422, 'Unprocessable Entity'
102n/a LOCKED = 423, 'Locked'
103n/a FAILED_DEPENDENCY = 424, 'Failed Dependency'
104n/a UPGRADE_REQUIRED = 426, 'Upgrade Required'
105n/a PRECONDITION_REQUIRED = (428, 'Precondition Required',
106n/a 'The origin server requires the request to be conditional')
107n/a TOO_MANY_REQUESTS = (429, 'Too Many Requests',
108n/a 'The user has sent too many requests in '
109n/a 'a given amount of time ("rate limiting")')
110n/a REQUEST_HEADER_FIELDS_TOO_LARGE = (431,
111n/a 'Request Header Fields Too Large',
112n/a 'The server is unwilling to process the request because its header '
113n/a 'fields are too large')
114n/a
115n/a # server errors
116n/a INTERNAL_SERVER_ERROR = (500, 'Internal Server Error',
117n/a 'Server got itself in trouble')
118n/a NOT_IMPLEMENTED = (501, 'Not Implemented',
119n/a 'Server does not support this operation')
120n/a BAD_GATEWAY = (502, 'Bad Gateway',
121n/a 'Invalid responses from another server/proxy')
122n/a SERVICE_UNAVAILABLE = (503, 'Service Unavailable',
123n/a 'The server cannot process the request due to a high load')
124n/a GATEWAY_TIMEOUT = (504, 'Gateway Timeout',
125n/a 'The gateway server did not receive a timely response')
126n/a HTTP_VERSION_NOT_SUPPORTED = (505, 'HTTP Version Not Supported',
127n/a 'Cannot fulfill request')
128n/a VARIANT_ALSO_NEGOTIATES = 506, 'Variant Also Negotiates'
129n/a INSUFFICIENT_STORAGE = 507, 'Insufficient Storage'
130n/a LOOP_DETECTED = 508, 'Loop Detected'
131n/a NOT_EXTENDED = 510, 'Not Extended'
132n/a NETWORK_AUTHENTICATION_REQUIRED = (511,
133n/a 'Network Authentication Required',
134n/a 'The client needs to authenticate to gain network access')