Coverage for value_object_pattern/usables/internet/http_status_code_value_object.py: 66.82%
209 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-11-21 14:31 +0000
« prev ^ index » next coverage.py v7.15.4, created at 2026-11-21 14:31 +0000
1# ruff: noqa: N802
2"""
3Provide a value object for HTTP response status codes.
4"""
6from __future__ import annotations 1abcdefghij
8from typing import ClassVar, NoReturn 1abcdefghij
10from value_object_pattern.decorators import validation 1abcdefghij
11from value_object_pattern.usables import IntegerValueObject 1abcdefghij
14class HttpStatusCodeValueObject(IntegerValueObject): 1abcdefghij
15 """
16 Validate and store an HTTP response status code.
18 Valid values are integers from `100` through `599`, including unassigned codes reserved for future extensions within
19 the five HTTP response classes. Instances can be created directly with `value` or through a named constructor for
20 known codes, such as `OK()` or `NOT_FOUND()`. The `reason_phrase` property exposes known IANA or legacy text and
21 returns `None` for unassigned codes.
23 References:
24 RFC 9110, Status Codes: https://www.rfc-editor.org/rfc/rfc9110.html#name-status-codes
25 IANA HTTP Status Code Registry: https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
27 Example:
28 ```python
29 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
31 ok = HttpStatusCodeValueObject.OK()
32 print(repr(ok))
33 # >>> HttpStatusCodeValueObject(value=200)
34 print(ok.reason_phrase)
35 # >>> OK
36 ```
37 """
39 _MIN_STATUS_CODE: int = 100 1abcdefghij
40 _MAX_STATUS_CODE: int = 599 1abcdefghij
41 _REASON_PHRASES: ClassVar[dict[int, str]] = { 1abcdefghij
42 100: 'Continue',
43 101: 'Switching Protocols',
44 102: 'Processing',
45 103: 'Early Hints',
46 104: 'Upload Resumption Supported',
47 200: 'OK',
48 201: 'Created',
49 202: 'Accepted',
50 203: 'Non-Authoritative Information',
51 204: 'No Content',
52 205: 'Reset Content',
53 206: 'Partial Content',
54 207: 'Multi-Status',
55 208: 'Already Reported',
56 226: 'IM Used',
57 300: 'Multiple Choices',
58 301: 'Moved Permanently',
59 302: 'Found',
60 303: 'See Other',
61 304: 'Not Modified',
62 305: 'Use Proxy',
63 306: 'Unused',
64 307: 'Temporary Redirect',
65 308: 'Permanent Redirect',
66 400: 'Bad Request',
67 401: 'Unauthorized',
68 402: 'Payment Required',
69 403: 'Forbidden',
70 404: 'Not Found',
71 405: 'Method Not Allowed',
72 406: 'Not Acceptable',
73 407: 'Proxy Authentication Required',
74 408: 'Request Timeout',
75 409: 'Conflict',
76 410: 'Gone',
77 411: 'Length Required',
78 412: 'Precondition Failed',
79 413: 'Content Too Large',
80 414: 'URI Too Long',
81 415: 'Unsupported Media Type',
82 416: 'Range Not Satisfiable',
83 417: 'Expectation Failed',
84 418: "I'm a Teapot",
85 421: 'Misdirected Request',
86 422: 'Unprocessable Content',
87 423: 'Locked',
88 424: 'Failed Dependency',
89 425: 'Too Early',
90 426: 'Upgrade Required',
91 428: 'Precondition Required',
92 429: 'Too Many Requests',
93 431: 'Request Header Fields Too Large',
94 451: 'Unavailable For Legal Reasons',
95 500: 'Internal Server Error',
96 501: 'Not Implemented',
97 502: 'Bad Gateway',
98 503: 'Service Unavailable',
99 504: 'Gateway Timeout',
100 505: 'HTTP Version Not Supported',
101 506: 'Variant Also Negotiates',
102 507: 'Insufficient Storage',
103 508: 'Loop Detected',
104 510: 'Not Extended',
105 511: 'Network Authentication Required',
106 }
108 @validation(order=1) 1abcdefghij
109 def _ensure_value_is_http_status_code(self, value: int) -> None: 1abcdefghij
110 """
111 Ensure the value is within the valid HTTP status-code range.
113 Args:
114 value (int): The HTTP status code to validate.
116 Raises:
117 ValueError: If the value is outside the HTTP status-code range.
118 """
119 if value < self._MIN_STATUS_CODE or value > self._MAX_STATUS_CODE:
120 self._raise_value_is_not_http_status_code(value=value)
122 def _raise_value_is_not_http_status_code(self, value: int) -> NoReturn: 1abcdefghij
123 """
124 Raise an error for a value outside the HTTP status-code range.
126 Args:
127 value (int): The out-of-range HTTP status code.
129 Raises:
130 ValueError: Always raised with the invalid value and valid range.
131 """
132 raise ValueError(f'HttpStatusCodeValueObject value <<<{value}>>> must be between {self._MIN_STATUS_CODE} and {self._MAX_STATUS_CODE}.') # noqa: E501 # fmt: skip
134 @property 1abcdefghij
135 def reason_phrase(self) -> str | None: 1abcdefghij
136 """
137 Return the known reason phrase for the status code.
139 Returns:
140 str | None: The IANA or legacy reason phrase, or `None` when the status code is unassigned.
142 Example:
143 ```python
144 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
146 print(HttpStatusCodeValueObject.NOT_FOUND().reason_phrase)
147 # >>> Not Found
148 ```
149 """
150 return self._REASON_PHRASES.get(self.value)
152 @classmethod 1abcdefghij
153 def CONTINUE(cls) -> HttpStatusCodeValueObject: 1abcdefghij
154 """
155 Create a value object for the 100 Continue HTTP status code.
157 Returns:
158 HttpStatusCodeValueObject: A value object containing `100`.
160 Example:
161 ```python
162 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
164 continue = HttpStatusCodeValueObject.CONTINUE()
165 print(repr(continue))
166 # >>> HttpStatusCodeValueObject(value=100)
167 ```
168 """
169 return cls(value=100)
171 @classmethod 1abcdefghij
172 def SWITCHING_PROTOCOLS(cls) -> HttpStatusCodeValueObject: 1abcdefghij
173 """
174 Create a value object for the 101 Switching Protocols HTTP status code.
176 Returns:
177 HttpStatusCodeValueObject: A value object containing `101`.
179 Example:
180 ```python
181 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
183 switching_protocols = HttpStatusCodeValueObject.SWITCHING_PROTOCOLS()
184 print(repr(switching_protocols))
185 # >>> HttpStatusCodeValueObject(value=101)
186 ```
187 """
188 return cls(value=101)
190 @classmethod 1abcdefghij
191 def PROCESSING(cls) -> HttpStatusCodeValueObject: 1abcdefghij
192 """
193 Create a value object for the 102 Processing HTTP status code.
195 Returns:
196 HttpStatusCodeValueObject: A value object containing `102`.
198 Example:
199 ```python
200 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
202 processing = HttpStatusCodeValueObject.PROCESSING()
203 print(repr(processing))
204 # >>> HttpStatusCodeValueObject(value=102)
205 ```
206 """
207 return cls(value=102)
209 @classmethod 1abcdefghij
210 def EARLY_HINTS(cls) -> HttpStatusCodeValueObject: 1abcdefghij
211 """
212 Create a value object for the 103 Early Hints HTTP status code.
214 Returns:
215 HttpStatusCodeValueObject: A value object containing `103`.
217 Example:
218 ```python
219 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
221 early_hints = HttpStatusCodeValueObject.EARLY_HINTS()
222 print(repr(early_hints))
223 # >>> HttpStatusCodeValueObject(value=103)
224 ```
225 """
226 return cls(value=103)
228 @classmethod 1abcdefghij
229 def UPLOAD_RESUMPTION_SUPPORTED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
230 """
231 Create a value object for the temporary 104 Upload Resumption Supported HTTP status code.
233 Returns:
234 HttpStatusCodeValueObject: A value object containing `104`.
236 Example:
237 ```python
238 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
240 upload_resumption_supported = HttpStatusCodeValueObject.UPLOAD_RESUMPTION_SUPPORTED()
241 print(repr(upload_resumption_supported))
242 # >>> HttpStatusCodeValueObject(value=104)
243 ```
244 """
245 return cls(value=104)
247 @classmethod 1abcdefghij
248 def OK(cls) -> HttpStatusCodeValueObject: 1abcdefghij
249 """
250 Create a value object for the 200 OK HTTP status code.
252 Returns:
253 HttpStatusCodeValueObject: A value object containing `200`.
255 Example:
256 ```python
257 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
259 ok = HttpStatusCodeValueObject.OK()
260 print(repr(ok))
261 # >>> HttpStatusCodeValueObject(value=200)
262 ```
263 """
264 return cls(value=200)
266 @classmethod 1abcdefghij
267 def CREATED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
268 """
269 Create a value object for the 201 Created HTTP status code.
271 Returns:
272 HttpStatusCodeValueObject: A value object containing `201`.
274 Example:
275 ```python
276 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
278 created = HttpStatusCodeValueObject.CREATED()
279 print(repr(created))
280 # >>> HttpStatusCodeValueObject(value=201)
281 ```
282 """
283 return cls(value=201)
285 @classmethod 1abcdefghij
286 def ACCEPTED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
287 """
288 Create a value object for the 202 Accepted HTTP status code.
290 Returns:
291 HttpStatusCodeValueObject: A value object containing `202`.
293 Example:
294 ```python
295 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
297 accepted = HttpStatusCodeValueObject.ACCEPTED()
298 print(repr(accepted))
299 # >>> HttpStatusCodeValueObject(value=202)
300 ```
301 """
302 return cls(value=202)
304 @classmethod 1abcdefghij
305 def NON_AUTHORITATIVE_INFORMATION(cls) -> HttpStatusCodeValueObject: 1abcdefghij
306 """
307 Create a value object for the 203 Non-Authoritative Information HTTP status code.
309 Returns:
310 HttpStatusCodeValueObject: A value object containing `203`.
312 Example:
313 ```python
314 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
316 non_authoritative_information = HttpStatusCodeValueObject.NON_AUTHORITATIVE_INFORMATION()
317 print(repr(non_authoritative_information))
318 # >>> HttpStatusCodeValueObject(value=203)
319 ```
320 """
321 return cls(value=203)
323 @classmethod 1abcdefghij
324 def NO_CONTENT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
325 """
326 Create a value object for the 204 No Content HTTP status code.
328 Returns:
329 HttpStatusCodeValueObject: A value object containing `204`.
331 Example:
332 ```python
333 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
335 no_content = HttpStatusCodeValueObject.NO_CONTENT()
336 print(repr(no_content))
337 # >>> HttpStatusCodeValueObject(value=204)
338 ```
339 """
340 return cls(value=204)
342 @classmethod 1abcdefghij
343 def RESET_CONTENT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
344 """
345 Create a value object for the 205 Reset Content HTTP status code.
347 Returns:
348 HttpStatusCodeValueObject: A value object containing `205`.
350 Example:
351 ```python
352 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
354 reset_content = HttpStatusCodeValueObject.RESET_CONTENT()
355 print(repr(reset_content))
356 # >>> HttpStatusCodeValueObject(value=205)
357 ```
358 """
359 return cls(value=205)
361 @classmethod 1abcdefghij
362 def PARTIAL_CONTENT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
363 """
364 Create a value object for the 206 Partial Content HTTP status code.
366 Returns:
367 HttpStatusCodeValueObject: A value object containing `206`.
369 Example:
370 ```python
371 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
373 partial_content = HttpStatusCodeValueObject.PARTIAL_CONTENT()
374 print(repr(partial_content))
375 # >>> HttpStatusCodeValueObject(value=206)
376 ```
377 """
378 return cls(value=206)
380 @classmethod 1abcdefghij
381 def MULTI_STATUS(cls) -> HttpStatusCodeValueObject: 1abcdefghij
382 """
383 Create a value object for the 207 Multi-Status HTTP status code.
385 Returns:
386 HttpStatusCodeValueObject: A value object containing `207`.
388 Example:
389 ```python
390 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
392 multi_status = HttpStatusCodeValueObject.MULTI_STATUS()
393 print(repr(multi_status))
394 # >>> HttpStatusCodeValueObject(value=207)
395 ```
396 """
397 return cls(value=207)
399 @classmethod 1abcdefghij
400 def ALREADY_REPORTED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
401 """
402 Create a value object for the 208 Already Reported HTTP status code.
404 Returns:
405 HttpStatusCodeValueObject: A value object containing `208`.
407 Example:
408 ```python
409 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
411 already_reported = HttpStatusCodeValueObject.ALREADY_REPORTED()
412 print(repr(already_reported))
413 # >>> HttpStatusCodeValueObject(value=208)
414 ```
415 """
416 return cls(value=208)
418 @classmethod 1abcdefghij
419 def IM_USED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
420 """
421 Create a value object for the 226 IM Used HTTP status code.
423 Returns:
424 HttpStatusCodeValueObject: A value object containing `226`.
426 Example:
427 ```python
428 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
430 im_used = HttpStatusCodeValueObject.IM_USED()
431 print(repr(im_used))
432 # >>> HttpStatusCodeValueObject(value=226)
433 ```
434 """
435 return cls(value=226)
437 @classmethod 1abcdefghij
438 def MULTIPLE_CHOICES(cls) -> HttpStatusCodeValueObject: 1abcdefghij
439 """
440 Create a value object for the 300 Multiple Choices HTTP status code.
442 Returns:
443 HttpStatusCodeValueObject: A value object containing `300`.
445 Example:
446 ```python
447 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
449 multiple_choices = HttpStatusCodeValueObject.MULTIPLE_CHOICES()
450 print(repr(multiple_choices))
451 # >>> HttpStatusCodeValueObject(value=300)
452 ```
453 """
454 return cls(value=300)
456 @classmethod 1abcdefghij
457 def MOVED_PERMANENTLY(cls) -> HttpStatusCodeValueObject: 1abcdefghij
458 """
459 Create a value object for the 301 Moved Permanently HTTP status code.
461 Returns:
462 HttpStatusCodeValueObject: A value object containing `301`.
464 Example:
465 ```python
466 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
468 moved_permanently = HttpStatusCodeValueObject.MOVED_PERMANENTLY()
469 print(repr(moved_permanently))
470 # >>> HttpStatusCodeValueObject(value=301)
471 ```
472 """
473 return cls(value=301)
475 @classmethod 1abcdefghij
476 def FOUND(cls) -> HttpStatusCodeValueObject: 1abcdefghij
477 """
478 Create a value object for the 302 Found HTTP status code.
480 Returns:
481 HttpStatusCodeValueObject: A value object containing `302`.
483 Example:
484 ```python
485 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
487 found = HttpStatusCodeValueObject.FOUND()
488 print(repr(found))
489 # >>> HttpStatusCodeValueObject(value=302)
490 ```
491 """
492 return cls(value=302)
494 @classmethod 1abcdefghij
495 def SEE_OTHER(cls) -> HttpStatusCodeValueObject: 1abcdefghij
496 """
497 Create a value object for the 303 See Other HTTP status code.
499 Returns:
500 HttpStatusCodeValueObject: A value object containing `303`.
502 Example:
503 ```python
504 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
506 see_other = HttpStatusCodeValueObject.SEE_OTHER()
507 print(repr(see_other))
508 # >>> HttpStatusCodeValueObject(value=303)
509 ```
510 """
511 return cls(value=303)
513 @classmethod 1abcdefghij
514 def NOT_MODIFIED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
515 """
516 Create a value object for the 304 Not Modified HTTP status code.
518 Returns:
519 HttpStatusCodeValueObject: A value object containing `304`.
521 Example:
522 ```python
523 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
525 not_modified = HttpStatusCodeValueObject.NOT_MODIFIED()
526 print(repr(not_modified))
527 # >>> HttpStatusCodeValueObject(value=304)
528 ```
529 """
530 return cls(value=304)
532 @classmethod 1abcdefghij
533 def USE_PROXY(cls) -> HttpStatusCodeValueObject: 1abcdefghij
534 """
535 Create a value object for the 305 Use Proxy HTTP status code.
537 Returns:
538 HttpStatusCodeValueObject: A value object containing `305`.
540 Example:
541 ```python
542 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
544 use_proxy = HttpStatusCodeValueObject.USE_PROXY()
545 print(repr(use_proxy))
546 # >>> HttpStatusCodeValueObject(value=305)
547 ```
548 """
549 return cls(value=305)
551 @classmethod 1abcdefghij
552 def UNUSED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
553 """
554 Create a value object for the unused 306 HTTP status code.
556 Returns:
557 HttpStatusCodeValueObject: A value object containing `306`.
559 Example:
560 ```python
561 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
563 unused = HttpStatusCodeValueObject.UNUSED()
564 print(repr(unused))
565 # >>> HttpStatusCodeValueObject(value=306)
566 ```
567 """
568 return cls(value=306)
570 @classmethod 1abcdefghij
571 def TEMPORARY_REDIRECT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
572 """
573 Create a value object for the 307 Temporary Redirect HTTP status code.
575 Returns:
576 HttpStatusCodeValueObject: A value object containing `307`.
578 Example:
579 ```python
580 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
582 temporary_redirect = HttpStatusCodeValueObject.TEMPORARY_REDIRECT()
583 print(repr(temporary_redirect))
584 # >>> HttpStatusCodeValueObject(value=307)
585 ```
586 """
587 return cls(value=307)
589 @classmethod 1abcdefghij
590 def PERMANENT_REDIRECT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
591 """
592 Create a value object for the 308 Permanent Redirect HTTP status code.
594 Returns:
595 HttpStatusCodeValueObject: A value object containing `308`.
597 Example:
598 ```python
599 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
601 permanent_redirect = HttpStatusCodeValueObject.PERMANENT_REDIRECT()
602 print(repr(permanent_redirect))
603 # >>> HttpStatusCodeValueObject(value=308)
604 ```
605 """
606 return cls(value=308)
608 @classmethod 1abcdefghij
609 def BAD_REQUEST(cls) -> HttpStatusCodeValueObject: 1abcdefghij
610 """
611 Create a value object for the 400 Bad Request HTTP status code.
613 Returns:
614 HttpStatusCodeValueObject: A value object containing `400`.
616 Example:
617 ```python
618 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
620 bad_request = HttpStatusCodeValueObject.BAD_REQUEST()
621 print(repr(bad_request))
622 # >>> HttpStatusCodeValueObject(value=400)
623 ```
624 """
625 return cls(value=400)
627 @classmethod 1abcdefghij
628 def UNAUTHORIZED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
629 """
630 Create a value object for the 401 Unauthorized HTTP status code.
632 Returns:
633 HttpStatusCodeValueObject: A value object containing `401`.
635 Example:
636 ```python
637 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
639 unauthorized = HttpStatusCodeValueObject.UNAUTHORIZED()
640 print(repr(unauthorized))
641 # >>> HttpStatusCodeValueObject(value=401)
642 ```
643 """
644 return cls(value=401)
646 @classmethod 1abcdefghij
647 def PAYMENT_REQUIRED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
648 """
649 Create a value object for the 402 Payment Required HTTP status code.
651 Returns:
652 HttpStatusCodeValueObject: A value object containing `402`.
654 Example:
655 ```python
656 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
658 payment_required = HttpStatusCodeValueObject.PAYMENT_REQUIRED()
659 print(repr(payment_required))
660 # >>> HttpStatusCodeValueObject(value=402)
661 ```
662 """
663 return cls(value=402)
665 @classmethod 1abcdefghij
666 def FORBIDDEN(cls) -> HttpStatusCodeValueObject: 1abcdefghij
667 """
668 Create a value object for the 403 Forbidden HTTP status code.
670 Returns:
671 HttpStatusCodeValueObject: A value object containing `403`.
673 Example:
674 ```python
675 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
677 forbidden = HttpStatusCodeValueObject.FORBIDDEN()
678 print(repr(forbidden))
679 # >>> HttpStatusCodeValueObject(value=403)
680 ```
681 """
682 return cls(value=403)
684 @classmethod 1abcdefghij
685 def NOT_FOUND(cls) -> HttpStatusCodeValueObject: 1abcdefghij
686 """
687 Create a value object for the 404 Not Found HTTP status code.
689 Returns:
690 HttpStatusCodeValueObject: A value object containing `404`.
692 Example:
693 ```python
694 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
696 not_found = HttpStatusCodeValueObject.NOT_FOUND()
697 print(repr(not_found))
698 # >>> HttpStatusCodeValueObject(value=404)
699 ```
700 """
701 return cls(value=404)
703 @classmethod 1abcdefghij
704 def METHOD_NOT_ALLOWED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
705 """
706 Create a value object for the 405 Method Not Allowed HTTP status code.
708 Returns:
709 HttpStatusCodeValueObject: A value object containing `405`.
711 Example:
712 ```python
713 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
715 method_not_allowed = HttpStatusCodeValueObject.METHOD_NOT_ALLOWED()
716 print(repr(method_not_allowed))
717 # >>> HttpStatusCodeValueObject(value=405)
718 ```
719 """
720 return cls(value=405)
722 @classmethod 1abcdefghij
723 def NOT_ACCEPTABLE(cls) -> HttpStatusCodeValueObject: 1abcdefghij
724 """
725 Create a value object for the 406 Not Acceptable HTTP status code.
727 Returns:
728 HttpStatusCodeValueObject: A value object containing `406`.
730 Example:
731 ```python
732 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
734 not_acceptable = HttpStatusCodeValueObject.NOT_ACCEPTABLE()
735 print(repr(not_acceptable))
736 # >>> HttpStatusCodeValueObject(value=406)
737 ```
738 """
739 return cls(value=406)
741 @classmethod 1abcdefghij
742 def PROXY_AUTHENTICATION_REQUIRED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
743 """
744 Create a value object for the 407 Proxy Authentication Required HTTP status code.
746 Returns:
747 HttpStatusCodeValueObject: A value object containing `407`.
749 Example:
750 ```python
751 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
753 proxy_authentication_required = HttpStatusCodeValueObject.PROXY_AUTHENTICATION_REQUIRED()
754 print(repr(proxy_authentication_required))
755 # >>> HttpStatusCodeValueObject(value=407)
756 ```
757 """
758 return cls(value=407)
760 @classmethod 1abcdefghij
761 def REQUEST_TIMEOUT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
762 """
763 Create a value object for the 408 Request Timeout HTTP status code.
765 Returns:
766 HttpStatusCodeValueObject: A value object containing `408`.
768 Example:
769 ```python
770 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
772 request_timeout = HttpStatusCodeValueObject.REQUEST_TIMEOUT()
773 print(repr(request_timeout))
774 # >>> HttpStatusCodeValueObject(value=408)
775 ```
776 """
777 return cls(value=408)
779 @classmethod 1abcdefghij
780 def CONFLICT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
781 """
782 Create a value object for the 409 Conflict HTTP status code.
784 Returns:
785 HttpStatusCodeValueObject: A value object containing `409`.
787 Example:
788 ```python
789 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
791 conflict = HttpStatusCodeValueObject.CONFLICT()
792 print(repr(conflict))
793 # >>> HttpStatusCodeValueObject(value=409)
794 ```
795 """
796 return cls(value=409)
798 @classmethod 1abcdefghij
799 def GONE(cls) -> HttpStatusCodeValueObject: 1abcdefghij
800 """
801 Create a value object for the 410 Gone HTTP status code.
803 Returns:
804 HttpStatusCodeValueObject: A value object containing `410`.
806 Example:
807 ```python
808 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
810 gone = HttpStatusCodeValueObject.GONE()
811 print(repr(gone))
812 # >>> HttpStatusCodeValueObject(value=410)
813 ```
814 """
815 return cls(value=410)
817 @classmethod 1abcdefghij
818 def LENGTH_REQUIRED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
819 """
820 Create a value object for the 411 Length Required HTTP status code.
822 Returns:
823 HttpStatusCodeValueObject: A value object containing `411`.
825 Example:
826 ```python
827 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
829 length_required = HttpStatusCodeValueObject.LENGTH_REQUIRED()
830 print(repr(length_required))
831 # >>> HttpStatusCodeValueObject(value=411)
832 ```
833 """
834 return cls(value=411)
836 @classmethod 1abcdefghij
837 def PRECONDITION_FAILED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
838 """
839 Create a value object for the 412 Precondition Failed HTTP status code.
841 Returns:
842 HttpStatusCodeValueObject: A value object containing `412`.
844 Example:
845 ```python
846 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
848 precondition_failed = HttpStatusCodeValueObject.PRECONDITION_FAILED()
849 print(repr(precondition_failed))
850 # >>> HttpStatusCodeValueObject(value=412)
851 ```
852 """
853 return cls(value=412)
855 @classmethod 1abcdefghij
856 def CONTENT_TOO_LARGE(cls) -> HttpStatusCodeValueObject: 1abcdefghij
857 """
858 Create a value object for the 413 Content Too Large HTTP status code.
860 Returns:
861 HttpStatusCodeValueObject: A value object containing `413`.
863 Example:
864 ```python
865 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
867 content_too_large = HttpStatusCodeValueObject.CONTENT_TOO_LARGE()
868 print(repr(content_too_large))
869 # >>> HttpStatusCodeValueObject(value=413)
870 ```
871 """
872 return cls(value=413)
874 @classmethod 1abcdefghij
875 def URI_TOO_LONG(cls) -> HttpStatusCodeValueObject: 1abcdefghij
876 """
877 Create a value object for the 414 URI Too Long HTTP status code.
879 Returns:
880 HttpStatusCodeValueObject: A value object containing `414`.
882 Example:
883 ```python
884 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
886 uri_too_long = HttpStatusCodeValueObject.URI_TOO_LONG()
887 print(repr(uri_too_long))
888 # >>> HttpStatusCodeValueObject(value=414)
889 ```
890 """
891 return cls(value=414)
893 @classmethod 1abcdefghij
894 def UNSUPPORTED_MEDIA_TYPE(cls) -> HttpStatusCodeValueObject: 1abcdefghij
895 """
896 Create a value object for the 415 Unsupported Media Type HTTP status code.
898 Returns:
899 HttpStatusCodeValueObject: A value object containing `415`.
901 Example:
902 ```python
903 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
905 unsupported_media_type = HttpStatusCodeValueObject.UNSUPPORTED_MEDIA_TYPE()
906 print(repr(unsupported_media_type))
907 # >>> HttpStatusCodeValueObject(value=415)
908 ```
909 """
910 return cls(value=415)
912 @classmethod 1abcdefghij
913 def RANGE_NOT_SATISFIABLE(cls) -> HttpStatusCodeValueObject: 1abcdefghij
914 """
915 Create a value object for the 416 Range Not Satisfiable HTTP status code.
917 Returns:
918 HttpStatusCodeValueObject: A value object containing `416`.
920 Example:
921 ```python
922 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
924 range_not_satisfiable = HttpStatusCodeValueObject.RANGE_NOT_SATISFIABLE()
925 print(repr(range_not_satisfiable))
926 # >>> HttpStatusCodeValueObject(value=416)
927 ```
928 """
929 return cls(value=416)
931 @classmethod 1abcdefghij
932 def EXPECTATION_FAILED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
933 """
934 Create a value object for the 417 Expectation Failed HTTP status code.
936 Returns:
937 HttpStatusCodeValueObject: A value object containing `417`.
939 Example:
940 ```python
941 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
943 expectation_failed = HttpStatusCodeValueObject.EXPECTATION_FAILED()
944 print(repr(expectation_failed))
945 # >>> HttpStatusCodeValueObject(value=417)
946 ```
947 """
948 return cls(value=417)
950 @classmethod 1abcdefghij
951 def IM_A_TEAPOT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
952 """
953 Create a value object for the legacy 418 I'm a Teapot HTTP status code.
955 IANA currently marks code 418 as unused; this constructor preserves the widely used legacy phrase.
957 Returns:
958 HttpStatusCodeValueObject: A value object containing `418`.
960 Example:
961 ```python
962 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
964 im_a_teapot = HttpStatusCodeValueObject.IM_A_TEAPOT()
965 print(repr(im_a_teapot))
966 # >>> HttpStatusCodeValueObject(value=418)
967 ```
968 """
969 return cls(value=418)
971 @classmethod 1abcdefghij
972 def MISDIRECTED_REQUEST(cls) -> HttpStatusCodeValueObject: 1abcdefghij
973 """
974 Create a value object for the 421 Misdirected Request HTTP status code.
976 Returns:
977 HttpStatusCodeValueObject: A value object containing `421`.
979 Example:
980 ```python
981 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
983 misdirected_request = HttpStatusCodeValueObject.MISDIRECTED_REQUEST()
984 print(repr(misdirected_request))
985 # >>> HttpStatusCodeValueObject(value=421)
986 ```
987 """
988 return cls(value=421)
990 @classmethod 1abcdefghij
991 def UNPROCESSABLE_CONTENT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
992 """
993 Create a value object for the 422 Unprocessable Content HTTP status code.
995 Returns:
996 HttpStatusCodeValueObject: A value object containing `422`.
998 Example:
999 ```python
1000 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1002 unprocessable_content = HttpStatusCodeValueObject.UNPROCESSABLE_CONTENT()
1003 print(repr(unprocessable_content))
1004 # >>> HttpStatusCodeValueObject(value=422)
1005 ```
1006 """
1007 return cls(value=422)
1009 @classmethod 1abcdefghij
1010 def LOCKED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1011 """
1012 Create a value object for the 423 Locked HTTP status code.
1014 Returns:
1015 HttpStatusCodeValueObject: A value object containing `423`.
1017 Example:
1018 ```python
1019 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1021 locked = HttpStatusCodeValueObject.LOCKED()
1022 print(repr(locked))
1023 # >>> HttpStatusCodeValueObject(value=423)
1024 ```
1025 """
1026 return cls(value=423)
1028 @classmethod 1abcdefghij
1029 def FAILED_DEPENDENCY(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1030 """
1031 Create a value object for the 424 Failed Dependency HTTP status code.
1033 Returns:
1034 HttpStatusCodeValueObject: A value object containing `424`.
1036 Example:
1037 ```python
1038 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1040 failed_dependency = HttpStatusCodeValueObject.FAILED_DEPENDENCY()
1041 print(repr(failed_dependency))
1042 # >>> HttpStatusCodeValueObject(value=424)
1043 ```
1044 """
1045 return cls(value=424)
1047 @classmethod 1abcdefghij
1048 def TOO_EARLY(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1049 """
1050 Create a value object for the 425 Too Early HTTP status code.
1052 Returns:
1053 HttpStatusCodeValueObject: A value object containing `425`.
1055 Example:
1056 ```python
1057 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1059 too_early = HttpStatusCodeValueObject.TOO_EARLY()
1060 print(repr(too_early))
1061 # >>> HttpStatusCodeValueObject(value=425)
1062 ```
1063 """
1064 return cls(value=425)
1066 @classmethod 1abcdefghij
1067 def UPGRADE_REQUIRED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1068 """
1069 Create a value object for the 426 Upgrade Required HTTP status code.
1071 Returns:
1072 HttpStatusCodeValueObject: A value object containing `426`.
1074 Example:
1075 ```python
1076 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1078 upgrade_required = HttpStatusCodeValueObject.UPGRADE_REQUIRED()
1079 print(repr(upgrade_required))
1080 # >>> HttpStatusCodeValueObject(value=426)
1081 ```
1082 """
1083 return cls(value=426)
1085 @classmethod 1abcdefghij
1086 def PRECONDITION_REQUIRED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1087 """
1088 Create a value object for the 428 Precondition Required HTTP status code.
1090 Returns:
1091 HttpStatusCodeValueObject: A value object containing `428`.
1093 Example:
1094 ```python
1095 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1097 precondition_required = HttpStatusCodeValueObject.PRECONDITION_REQUIRED()
1098 print(repr(precondition_required))
1099 # >>> HttpStatusCodeValueObject(value=428)
1100 ```
1101 """
1102 return cls(value=428)
1104 @classmethod 1abcdefghij
1105 def TOO_MANY_REQUESTS(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1106 """
1107 Create a value object for the 429 Too Many Requests HTTP status code.
1109 Returns:
1110 HttpStatusCodeValueObject: A value object containing `429`.
1112 Example:
1113 ```python
1114 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1116 too_many_requests = HttpStatusCodeValueObject.TOO_MANY_REQUESTS()
1117 print(repr(too_many_requests))
1118 # >>> HttpStatusCodeValueObject(value=429)
1119 ```
1120 """
1121 return cls(value=429)
1123 @classmethod 1abcdefghij
1124 def REQUEST_HEADER_FIELDS_TOO_LARGE(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1125 """
1126 Create a value object for the 431 Request Header Fields Too Large HTTP status code.
1128 Returns:
1129 HttpStatusCodeValueObject: A value object containing `431`.
1131 Example:
1132 ```python
1133 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1135 request_header_fields_too_large = HttpStatusCodeValueObject.REQUEST_HEADER_FIELDS_TOO_LARGE()
1136 print(repr(request_header_fields_too_large))
1137 # >>> HttpStatusCodeValueObject(value=431)
1138 ```
1139 """
1140 return cls(value=431)
1142 @classmethod 1abcdefghij
1143 def UNAVAILABLE_FOR_LEGAL_REASONS(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1144 """
1145 Create a value object for the 451 Unavailable For Legal Reasons HTTP status code.
1147 Returns:
1148 HttpStatusCodeValueObject: A value object containing `451`.
1150 Example:
1151 ```python
1152 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1154 unavailable_for_legal_reasons = HttpStatusCodeValueObject.UNAVAILABLE_FOR_LEGAL_REASONS()
1155 print(repr(unavailable_for_legal_reasons))
1156 # >>> HttpStatusCodeValueObject(value=451)
1157 ```
1158 """
1159 return cls(value=451)
1161 @classmethod 1abcdefghij
1162 def INTERNAL_SERVER_ERROR(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1163 """
1164 Create a value object for the 500 Internal Server Error HTTP status code.
1166 Returns:
1167 HttpStatusCodeValueObject: A value object containing `500`.
1169 Example:
1170 ```python
1171 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1173 internal_server_error = HttpStatusCodeValueObject.INTERNAL_SERVER_ERROR()
1174 print(repr(internal_server_error))
1175 # >>> HttpStatusCodeValueObject(value=500)
1176 ```
1177 """
1178 return cls(value=500)
1180 @classmethod 1abcdefghij
1181 def NOT_IMPLEMENTED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1182 """
1183 Create a value object for the 501 Not Implemented HTTP status code.
1185 Returns:
1186 HttpStatusCodeValueObject: A value object containing `501`.
1188 Example:
1189 ```python
1190 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1192 not_implemented = HttpStatusCodeValueObject.NOT_IMPLEMENTED()
1193 print(repr(not_implemented))
1194 # >>> HttpStatusCodeValueObject(value=501)
1195 ```
1196 """
1197 return cls(value=501)
1199 @classmethod 1abcdefghij
1200 def BAD_GATEWAY(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1201 """
1202 Create a value object for the 502 Bad Gateway HTTP status code.
1204 Returns:
1205 HttpStatusCodeValueObject: A value object containing `502`.
1207 Example:
1208 ```python
1209 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1211 bad_gateway = HttpStatusCodeValueObject.BAD_GATEWAY()
1212 print(repr(bad_gateway))
1213 # >>> HttpStatusCodeValueObject(value=502)
1214 ```
1215 """
1216 return cls(value=502)
1218 @classmethod 1abcdefghij
1219 def SERVICE_UNAVAILABLE(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1220 """
1221 Create a value object for the 503 Service Unavailable HTTP status code.
1223 Returns:
1224 HttpStatusCodeValueObject: A value object containing `503`.
1226 Example:
1227 ```python
1228 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1230 service_unavailable = HttpStatusCodeValueObject.SERVICE_UNAVAILABLE()
1231 print(repr(service_unavailable))
1232 # >>> HttpStatusCodeValueObject(value=503)
1233 ```
1234 """
1235 return cls(value=503)
1237 @classmethod 1abcdefghij
1238 def GATEWAY_TIMEOUT(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1239 """
1240 Create a value object for the 504 Gateway Timeout HTTP status code.
1242 Returns:
1243 HttpStatusCodeValueObject: A value object containing `504`.
1245 Example:
1246 ```python
1247 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1249 gateway_timeout = HttpStatusCodeValueObject.GATEWAY_TIMEOUT()
1250 print(repr(gateway_timeout))
1251 # >>> HttpStatusCodeValueObject(value=504)
1252 ```
1253 """
1254 return cls(value=504)
1256 @classmethod 1abcdefghij
1257 def HTTP_VERSION_NOT_SUPPORTED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1258 """
1259 Create a value object for the 505 HTTP Version Not Supported HTTP status code.
1261 Returns:
1262 HttpStatusCodeValueObject: A value object containing `505`.
1264 Example:
1265 ```python
1266 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1268 http_version_not_supported = HttpStatusCodeValueObject.HTTP_VERSION_NOT_SUPPORTED()
1269 print(repr(http_version_not_supported))
1270 # >>> HttpStatusCodeValueObject(value=505)
1271 ```
1272 """
1273 return cls(value=505)
1275 @classmethod 1abcdefghij
1276 def VARIANT_ALSO_NEGOTIATES(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1277 """
1278 Create a value object for the 506 Variant Also Negotiates HTTP status code.
1280 Returns:
1281 HttpStatusCodeValueObject: A value object containing `506`.
1283 Example:
1284 ```python
1285 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1287 variant_also_negotiates = HttpStatusCodeValueObject.VARIANT_ALSO_NEGOTIATES()
1288 print(repr(variant_also_negotiates))
1289 # >>> HttpStatusCodeValueObject(value=506)
1290 ```
1291 """
1292 return cls(value=506)
1294 @classmethod 1abcdefghij
1295 def INSUFFICIENT_STORAGE(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1296 """
1297 Create a value object for the 507 Insufficient Storage HTTP status code.
1299 Returns:
1300 HttpStatusCodeValueObject: A value object containing `507`.
1302 Example:
1303 ```python
1304 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1306 insufficient_storage = HttpStatusCodeValueObject.INSUFFICIENT_STORAGE()
1307 print(repr(insufficient_storage))
1308 # >>> HttpStatusCodeValueObject(value=507)
1309 ```
1310 """
1311 return cls(value=507)
1313 @classmethod 1abcdefghij
1314 def LOOP_DETECTED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1315 """
1316 Create a value object for the 508 Loop Detected HTTP status code.
1318 Returns:
1319 HttpStatusCodeValueObject: A value object containing `508`.
1321 Example:
1322 ```python
1323 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1325 loop_detected = HttpStatusCodeValueObject.LOOP_DETECTED()
1326 print(repr(loop_detected))
1327 # >>> HttpStatusCodeValueObject(value=508)
1328 ```
1329 """
1330 return cls(value=508)
1332 @classmethod 1abcdefghij
1333 def NOT_EXTENDED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1334 """
1335 Create a value object for the obsolete 510 Not Extended HTTP status code.
1337 Returns:
1338 HttpStatusCodeValueObject: A value object containing `510`.
1340 Example:
1341 ```python
1342 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1344 not_extended = HttpStatusCodeValueObject.NOT_EXTENDED()
1345 print(repr(not_extended))
1346 # >>> HttpStatusCodeValueObject(value=510)
1347 ```
1348 """
1349 return cls(value=510)
1351 @classmethod 1abcdefghij
1352 def NETWORK_AUTHENTICATION_REQUIRED(cls) -> HttpStatusCodeValueObject: 1abcdefghij
1353 """
1354 Create a value object for the 511 Network Authentication Required HTTP status code.
1356 Returns:
1357 HttpStatusCodeValueObject: A value object containing `511`.
1359 Example:
1360 ```python
1361 from value_object_pattern.usables.internet import HttpStatusCodeValueObject
1363 network_authentication_required = HttpStatusCodeValueObject.NETWORK_AUTHENTICATION_REQUIRED()
1364 print(repr(network_authentication_required))
1365 # >>> HttpStatusCodeValueObject(value=511)
1366 ```
1367 """
1368 return cls(value=511)