Generate unique ID for URL

John Gordon gordon at panix.com
Tue Nov 13 18:34:02 EST 2012


In <0692e6a2-343c-4eb0-be57-fe5c815efb99 at googlegroups.com> Richard <richardbp at gmail.com> writes:

> 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?

Does the ID need to contain all the information necessary to recreate the
original URL?

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list