Generate unique ID for URL

Richard richardbp at gmail.com
Wed Nov 14 00:20:53 CET 2012


Hello,

I want to create a URL-safe unique ID for URL's.
Currently I use:
url_id = base64.urlsafe_b64encode(url)

>>> base64.urlsafe_b64encode('docs.python.org/library/uuid.html')
'ZG9jcy5weXRob24ub3JnL2xpYnJhcnkvdXVpZC5odG1s'

I would prefer more concise ID's. 
What do you recommend? - Compression?

Richard


More information about the Python-list mailing list