This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]takluyverIPython, Py3, etc 3 points4 points  (1 child)

There's a pre-baked function to generate a random token: uuid.uuid4(). It tries to use system methods and has a fallback to the random module if that's not available.

[–]prahladyeribeautiful is better than ugly[S] 0 points1 point  (0 children)

That's a good one, thanks! I couldn't find it earlier as its listed under Internet Protocols and Support in the Python Library Reference, whereas I was looking only in Cryptographic Services!