This is python's copy of nanoid!
Safe. It uses cryptographically strong random generator (urandom).
Compact. It uses more symbols than UUID (A-Za-z0-9_~
)
and has the same number of unique options in just 22 symbols instead of 36.
pip install nanoid
Generate ID using defaults
import nanoid
id = nanoid.generate()
Change ID length
id = nanoid.generate(size=3)
Change ID alphabet
id = nanoid.generate(alphabet="1234567890abcdef")
Change ID length and alphabet
nanoid.generate(alphabet="1234567890abcdef", size="3")
The MIT License (MIT). Please see License File for more information.