urlstd.parse.ValidityState#
- class urlstd.parse.ValidityState(valid: bool = True, error_types: list[str] = <factory>, descriptions: list[str] = <factory>, validation_errors: int = 0, disable_logging: bool = True)
Bases:
object
A validation status.
See also
Examples
>>> URL.can_parse('https://example/%?%#%') True >>> validity = ValidityState() >>> URLValidator.is_valid('https://example/%?%#%', validity=validity) False >>> validity.valid False >>> validity.validation_errors 3 >>> validity.descriptions[0] "invalid-URL-unit: incorrect percent encoding is found: '%' in 'https://example/%?%#%' at position 20" >>> validity.descriptions[1] "invalid-URL-unit: incorrect percent encoding is found: '%#%' in 'https://example/%?%#%' at position 18" >>> validity.descriptions[2] "invalid-URL-unit: incorrect percent encoding is found: '%?%' in 'https://example/%?%#%' at position 16"
Methods:
__add__
(other)This API is for internal use only.
__iadd__
(other)This API is for internal use only.
prepend
(msg, *args)This API is for internal use only.
reset
()This API is for internal use only.
Attributes:
True to disable logging, False otherwise.
True if there are no validation errors, False otherwise.
A number of validation errors.
A list of error type names.
A list of error descriptions.