uuid¶
validators.uuid.uuid(value)
¶
Return whether or not given value is a valid UUID-v4 string.
This validator is based on WTForms UUID validator.
Examples:
>>> uuid('2bc1c94f-0deb-43e9-92a1-4775189ec9f8')
# Output: True
>>> uuid('2bc1c94f 0deb-43e9-92a1-4775189ec9f8')
# Output: ValidationError(func=uuid, ...)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
Union[str, UUID]
|
UUID string or object to validate. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
Source code in src/validators/uuid.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|