Web Analytics

Python secrets.token_urlsafe() Function

Secretsโ€ขTokens

The secrets.token_urlsafe() function generates a secure random URL-safe text string.

Perfect for session tokens, CSRF tokens, and any token that needs to be passed in URLs.

Syntax

secrets.token_urlsafe(nbytes=None)

Return Value

A random URL-safe text string.

Example

Output
Click Run to execute your code