In brief
secrets.token_urlsafe(32) creates a textual token from 32 random bytes using URL-safe encoding. The argument is a byte count, not a guaranteed final character count.
Useful to know
secrets.token_urlsafe(32) creates a textual token from 32 random bytes using URL-safe encoding. The argument is a byte count, not a guaranteed final character count. [1]
Randomness is only one part of using it. The application separately defines expiry, single use and storage. Do not expose active tokens in public logs or replace the generator with a predictable counter merely for convenient formatting.
Sources
For further detail and to check the information: