You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import uuid
|
|
|
|
|
|
|
|
def base62uuid(crop=8):
|
|
|
|
alp = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|
|
|
id = uuid.uuid4().int
|
|
|
|
ret = ''
|
|
|
|
|
|
|
|
while id:
|
|
|
|
ret = alp[id % 62] + ret
|
|
|
|
id //= 62
|
|
|
|
|
|
|
|
return ret[:crop] if len(ret) else '0'
|