uuid¶
- validators.uuid.uuid(value: str | UUID, /)¶
Return whether or not given value is a valid UUID-v4 string.
This validator is based on [WTForms UUID validator][1].
[1]: https://github.com/wtforms/wtforms/blob/master/src/wtforms/validators.py#L539
Examples
>>> uuid('2bc1c94f-0deb-43e9-92a1-4775189ec9f8') True >>> uuid('2bc1c94f 0deb-43e9-92a1-4775189ec9f8') ValidationError(func=uuid, args={'value': '2bc1c94f 0deb-43e9-92a1-4775189ec9f8'})
- Parameters:
value – UUID string or object to validate.
- Returns:
If value is a valid UUID. (ValidationError): If value is an invalid UUID.
- Return type:
(Literal[True])