Reputation: 1591
I was wondering if anyone knows of a good way to generate GUIDs on python google app engine. I feel like there is a simple way that people are using, what would you suggest.
Upvotes: 8
Views: 3218
Reputation: 5886
Code example using the uuid module:
from uuid import uuid4
print(uuid4())
# Output: 7d720c5a-b3e9-455e-961c-0e37b330b098
Upvotes: 5
Reputation: 33249
The uuid module should be available.
Why do you need uuids? Usually they're necessary to make really unique primary keys, but GAE's datastore essentially ought to be taking care of that for you.
Upvotes: 5
Reputation: 5858
Any chance they are guid's for things you're storing in the datastore?
If so, I believe object.key is a GUID
Upvotes: 0
Reputation: 21393
Assuming the module is available in Google App Engine, check out Python's uuid module.
Upvotes: 0