logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

__init__.py (6733B)


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