encoding

validators.encoding.base16(value: str, /)

Return whether or not given value is a valid base16 encoding.

Examples

>>> base16('a3f4b2')
True
>>> base16('a3f4Z1')
ValidationError(func=base16, args={'value': 'a3f4Z1'})
Parameters:

value – base16 string to validate.

Returns:

If value is a valid base16 encoding. (ValidationError): If value is an invalid base16 encoding.

Return type:

(Literal[True])

validators.encoding.base32(value: str, /)

Return whether or not given value is a valid base32 encoding.

Examples

>>> base32('MFZWIZLTOQ======')
True
>>> base32('MfZW3zLT9Q======')
ValidationError(func=base32, args={'value': 'MfZW3zLT9Q======'})
Parameters:

value – base32 string to validate.

Returns:

If value is a valid base32 encoding. (ValidationError): If value is an invalid base32 encoding.

Return type:

(Literal[True])

validators.encoding.base58(value: str, /)

Return whether or not given value is a valid base58 encoding.

Examples

>>> base58('14pq6y9H2DLGahPsM4s7ugsNSD2uxpHsJx')
True
>>> base58('cUSECm5YzcXJwP')
True
Parameters:

value – base58 string to validate.

Returns:

If value is a valid base58 encoding. (ValidationError): If value is an invalid base58 encoding.

Return type:

(Literal[True])

validators.encoding.base64(value: str, /)

Return whether or not given value is a valid base64 encoding.

Examples

>>> base64('Y2hhcmFjdGVyIHNldA==')
True
>>> base64('cUSECm5YzcXJwP')
ValidationError(func=base64, args={'value': 'cUSECm5YzcXJwP'})
Parameters:

value – base64 string to validate.

Returns:

If value is a valid base64 encoding. (ValidationError): If value is an invalid base64 encoding.

Return type:

(Literal[True])