Skip to content

Instantly share code, notes, and snippets.

@davidbgk
Created July 19, 2012 01:31
Show Gist options
  • Save davidbgk/3140176 to your computer and use it in GitHub Desktop.
Save davidbgk/3140176 to your computer and use it in GitHub Desktop.
128-bit URLs In Python (see http://pthree.org/2012/07/16/128-bit-urls-in-python/ for details)
>>> import base64
>>> import uuid
>>> u = uuid.uuid4()
>>> print base64.urlsafe_b64encode(u.bytes)[:22]
'1ySOK3mWSWmKOtyNOpDsuQ'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment