hytos / DTI_PID / WebServer / app / api / status.py @ ef90c19c
이력 | 보기 | 이력해설 | 다운로드 (2.38 KB)
1 | 5f6cb499 | humkyung | """
|
---|---|---|---|
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 | |||
8 | |||
9 | def is_informational(code): |
||
10 | return 100 <= code <= 199 |
||
11 | |||
12 | |||
13 | def is_success(code): |
||
14 | return 200 <= code <= 299 |
||
15 | |||
16 | |||
17 | def is_redirect(code): |
||
18 | return 300 <= code <= 399 |
||
19 | |||
20 | |||
21 | def is_client_error(code): |
||
22 | return 400 <= code <= 499 |
||
23 | |||
24 | |||
25 | def is_server_error(code): |
||
26 | return 500 <= code <= 599 |
||
27 | |||
28 | |||
29 | HTTP_100_CONTINUE = 100
|
||
30 | HTTP_101_SWITCHING_PROTOCOLS = 101
|
||
31 | HTTP_200_OK = 200
|
||
32 | HTTP_201_CREATED = 201
|
||
33 | HTTP_202_ACCEPTED = 202
|
||
34 | HTTP_203_NON_AUTHORITATIVE_INFORMATION = 203
|
||
35 | HTTP_204_NO_CONTENT = 204
|
||
36 | HTTP_205_RESET_CONTENT = 205
|
||
37 | HTTP_206_PARTIAL_CONTENT = 206
|
||
38 | HTTP_207_MULTI_STATUS = 207
|
||
39 | HTTP_208_ALREADY_REPORTED = 208
|
||
40 | HTTP_226_IM_USED = 226
|
||
41 | HTTP_300_MULTIPLE_CHOICES = 300
|
||
42 | HTTP_301_MOVED_PERMANENTLY = 301
|
||
43 | HTTP_302_FOUND = 302
|
||
44 | HTTP_303_SEE_OTHER = 303
|
||
45 | HTTP_304_NOT_MODIFIED = 304
|
||
46 | HTTP_305_USE_PROXY = 305
|
||
47 | HTTP_306_RESERVED = 306
|
||
48 | HTTP_307_TEMPORARY_REDIRECT = 307
|
||
49 | HTTP_308_PERMANENT_REDIRECT = 308
|
||
50 | HTTP_400_BAD_REQUEST = 400
|
||
51 | HTTP_401_UNAUTHORIZED = 401
|
||
52 | HTTP_402_PAYMENT_REQUIRED = 402
|
||
53 | HTTP_403_FORBIDDEN = 403
|
||
54 | HTTP_404_NOT_FOUND = 404
|
||
55 | HTTP_405_METHOD_NOT_ALLOWED = 405
|
||
56 | HTTP_406_NOT_ACCEPTABLE = 406
|
||
57 | HTTP_407_PROXY_AUTHENTICATION_REQUIRED = 407
|
||
58 | HTTP_408_REQUEST_TIMEOUT = 408
|
||
59 | HTTP_409_CONFLICT = 409
|
||
60 | HTTP_410_GONE = 410
|
||
61 | HTTP_411_LENGTH_REQUIRED = 411
|
||
62 | HTTP_412_PRECONDITION_FAILED = 412
|
||
63 | HTTP_413_REQUEST_ENTITY_TOO_LARGE = 413
|
||
64 | HTTP_414_REQUEST_URI_TOO_LONG = 414
|
||
65 | HTTP_415_UNSUPPORTED_MEDIA_TYPE = 415
|
||
66 | HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE = 416
|
||
67 | HTTP_417_EXPECTATION_FAILED = 417
|
||
68 | HTTP_418_IM_A_TEAPOT = 418
|
||
69 | HTTP_422_UNPROCESSABLE_ENTITY = 422
|
||
70 | HTTP_423_LOCKED = 423
|
||
71 | HTTP_424_FAILED_DEPENDENCY = 424
|
||
72 | HTTP_426_UPGRADE_REQUIRED = 426
|
||
73 | HTTP_428_PRECONDITION_REQUIRED = 428
|
||
74 | HTTP_429_TOO_MANY_REQUESTS = 429
|
||
75 | HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE = 431
|
||
76 | HTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS = 451
|
||
77 | HTTP_500_INTERNAL_SERVER_ERROR = 500
|
||
78 | HTTP_501_NOT_IMPLEMENTED = 501
|
||
79 | HTTP_502_BAD_GATEWAY = 502
|
||
80 | HTTP_503_SERVICE_UNAVAILABLE = 503
|
||
81 | HTTP_504_GATEWAY_TIMEOUT = 504
|
||
82 | HTTP_505_HTTP_VERSION_NOT_SUPPORTED = 505
|
||
83 | HTTP_506_VARIANT_ALSO_NEGOTIATES = 506
|
||
84 | HTTP_507_INSUFFICIENT_STORAGE = 507
|
||
85 | HTTP_508_LOOP_DETECTED = 508
|
||
86 | HTTP_509_BANDWIDTH_LIMIT_EXCEEDED = 509
|
||
87 | HTTP_510_NOT_EXTENDED = 510
|
||
88 | HTTP_511_NETWORK_AUTHENTICATION_REQUIRED = 511 |