A validator to validate whether the given value is valid IPv4Address or not. :raises ValidationError: if value is invalid IPv4Address.
(value: Any)
| 118 | |
| 119 | |
| 120 | def validate_ipv4_address(value: Any) -> None: |
| 121 | """ |
| 122 | A validator to validate whether the given value is valid IPv4Address or not. |
| 123 | |
| 124 | :raises ValidationError: if value is invalid IPv4Address. |
| 125 | """ |
| 126 | |
| 127 | try: |
| 128 | ipaddress.IPv4Address(value) |
| 129 | except ValueError: |
| 130 | raise ValidationError(f"'{value}' is not a valid IPv4 address.") |
| 131 | |
| 132 | |
| 133 | def validate_ipv6_address(value: Any) -> None: |
no test coverage detected
searching dependent graphs…