encoding¶
validators.encoding.base16(value)
¶
Return whether or not given value is a valid base16 encoding.
Examples:
>>> base16('a3f4b2')
# Output: True
>>> base16('a3f4Z1')
# Output: ValidationError(func=base16, args={'value': 'a3f4Z1'})
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
base16 string to validate. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
Source code in src/validators/encoding.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
validators.encoding.base32(value)
¶
Return whether or not given value is a valid base32 encoding.
Examples:
>>> base32('MFZWIZLTOQ======')
# Output: True
>>> base32('MfZW3zLT9Q======')
# Output: ValidationError(func=base32, args={'value': 'MfZW3zLT9Q======'})
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
base32 string to validate. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
Source code in src/validators/encoding.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
validators.encoding.base58(value)
¶
Return whether or not given value is a valid base58 encoding.
Examples:
>>> base58('14pq6y9H2DLGahPsM4s7ugsNSD2uxpHsJx')
# Output: True
>>> base58('cUSECm5YzcXJwP')
# Output: ValidationError(func=base58, args={'value': 'cUSECm5YzcXJwP'})
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
base58 string to validate. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
Source code in src/validators/encoding.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
validators.encoding.base64(value)
¶
Return whether or not given value is a valid base64 encoding.
Examples:
>>> base64('Y2hhcmFjdGVyIHNldA==')
# Output: True
>>> base64('cUSECm5YzcXJwP')
# Output: ValidationError(func=base64, args={'value': 'cUSECm5YzcXJwP'})
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
base64 string to validate. |
required |
Returns:
Type | Description |
---|---|
Literal[True]
|
If |
ValidationError
|
If |
Source code in src/validators/encoding.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|