Skip to content

Instantly share code, notes, and snippets.

@brianv0
Created January 22, 2016 21:25
Show Gist options
  • Save brianv0/d5c6c23e685d935f42b4 to your computer and use it in GitHub Desktop.
Save brianv0/d5c6c23e685d935f42b4 to your computer and use it in GitHub Desktop.
Random Client ID
import uuid
import struct
import base64
u = uuid.uuid4()
max_int64 = 0xFFFFFFFFFFFFFFFF
packed = struct.pack('>QQ', (u.int >> 64) & max_int64, u.int & max_int64)
client_id = base64.b64encode(packed)
print client_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment