You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

status.py 2.4KB

5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. """
  2. Descriptive HTTP status codes, for code readability.
  3. See RFC 2616 - https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
  4. And RFC 6585 - https://tools.ietf.org/html/rfc6585
  5. And RFC 4918 - https://tools.ietf.org/html/rfc4918
  6. """
  7. def is_informational(code):
  8. return 100 <= code <= 199
  9. def is_success(code):
  10. return 200 <= code <= 299
  11. def is_redirect(code):
  12. return 300 <= code <= 399
  13. def is_client_error(code):
  14. return 400 <= code <= 499
  15. def is_server_error(code):
  16. return 500 <= code <= 599
  17. HTTP_100_CONTINUE = 100
  18. HTTP_101_SWITCHING_PROTOCOLS = 101
  19. HTTP_200_OK = 200
  20. HTTP_201_CREATED = 201
  21. HTTP_202_ACCEPTED = 202
  22. HTTP_203_NON_AUTHORITATIVE_INFORMATION = 203
  23. HTTP_204_NO_CONTENT = 204
  24. HTTP_205_RESET_CONTENT = 205
  25. HTTP_206_PARTIAL_CONTENT = 206
  26. HTTP_207_MULTI_STATUS = 207
  27. HTTP_208_ALREADY_REPORTED = 208
  28. HTTP_226_IM_USED = 226
  29. HTTP_300_MULTIPLE_CHOICES = 300
  30. HTTP_301_MOVED_PERMANENTLY = 301
  31. HTTP_302_FOUND = 302
  32. HTTP_303_SEE_OTHER = 303
  33. HTTP_304_NOT_MODIFIED = 304
  34. HTTP_305_USE_PROXY = 305
  35. HTTP_306_RESERVED = 306
  36. HTTP_307_TEMPORARY_REDIRECT = 307
  37. HTTP_308_PERMANENT_REDIRECT = 308
  38. HTTP_400_BAD_REQUEST = 400
  39. HTTP_401_UNAUTHORIZED = 401
  40. HTTP_402_PAYMENT_REQUIRED = 402
  41. HTTP_403_FORBIDDEN = 403
  42. HTTP_404_NOT_FOUND = 404
  43. HTTP_405_METHOD_NOT_ALLOWED = 405
  44. HTTP_406_NOT_ACCEPTABLE = 406
  45. HTTP_407_PROXY_AUTHENTICATION_REQUIRED = 407
  46. HTTP_408_REQUEST_TIMEOUT = 408
  47. HTTP_409_CONFLICT = 409
  48. HTTP_410_GONE = 410
  49. HTTP_411_LENGTH_REQUIRED = 411
  50. HTTP_412_PRECONDITION_FAILED = 412
  51. HTTP_413_REQUEST_ENTITY_TOO_LARGE = 413
  52. HTTP_414_REQUEST_URI_TOO_LONG = 414
  53. HTTP_415_UNSUPPORTED_MEDIA_TYPE = 415
  54. HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE = 416
  55. HTTP_417_EXPECTATION_FAILED = 417
  56. HTTP_422_UNPROCESSABLE_ENTITY = 422
  57. HTTP_423_LOCKED = 423
  58. HTTP_424_FAILED_DEPENDENCY = 424
  59. HTTP_426_UPGRADE_REQUIRED = 426
  60. HTTP_428_PRECONDITION_REQUIRED = 428
  61. HTTP_429_TOO_MANY_REQUESTS = 429
  62. HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE = 431
  63. HTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS = 451
  64. HTTP_500_INTERNAL_SERVER_ERROR = 500
  65. HTTP_501_NOT_IMPLEMENTED = 501
  66. HTTP_502_BAD_GATEWAY = 502
  67. HTTP_503_SERVICE_UNAVAILABLE = 503
  68. HTTP_504_GATEWAY_TIMEOUT = 504
  69. HTTP_505_HTTP_VERSION_NOT_SUPPORTED = 505
  70. HTTP_506_VARIANT_ALSO_NEGOTIATES = 506
  71. HTTP_507_INSUFFICIENT_STORAGE = 507
  72. HTTP_508_LOOP_DETECTED = 508
  73. HTTP_509_BANDWIDTH_LIMIT_EXCEEDED = 509
  74. HTTP_510_NOT_EXTENDED = 510
  75. HTTP_511_NETWORK_AUTHENTICATION_REQUIRED = 511