binascii.b2a_base64(os.urandom(24))[:-1] is faster and much secure since:
- does not involve uuid, that is not suitable for secure token generations
- use OS provided much more secure random as opposed to python random
- generate 32-byte length string too, but,
64**24 = 2**144 random items, while your way generates 256**16 = 2**128 variants
it needs to be checked for special symbols like / and +
binascii.b2a_base64(os.urandom(24))[:-1]is faster and much secure since:64**24 = 2**144random items, while your way generates256**16 = 2**128variantsit needs to be checked for special symbols like
/and+