balena-sdk-python
balena-sdk-python copied to clipboard
Not all strings of length 32 or 64 are valid UUIDs
https://github.com/balena-io/balena-sdk-python/blob/b220606083d7da8723612154995ed45701c5a792/balena/utils.py#L28-L41
Not all strings of length 32 or 64 are valid UUIDs, see https://en.wikipedia.org/wiki/Universally_unique_identifier
A common way to check for the UUID validity seems to be something like
from uuid import UUID
try:
UUID(uuid_to_test)
except ValueError:
return False
return True
Originally posted by @pranasziaukas in https://github.com/balena-io/balena-sdk-python/pull/326#discussion_r1238661657