uuid

Fixed identifier for a machine (uuid.getnode)

Fixed identifier for a machine (uuid.getnode) Question: I’m trying to find something I can use as a unique string/number for my script that is fixed in a machine and easily obtainable(cross-platform). I presume a machine would have a network card. I don’t need it to be really unique, but the necessary is it should be …

Total answers: 4

How to use UUID

How to use UUID Question: I am trying to get unique IDs for my Django objects. In Django 1.8 they have the UUIDField. I am unsure how to use this field in order to generate unique IDs for each object in my model. Here is what I have for the UUIDField import uuid from django.db …

Total answers: 7

How to use UUIDs instead of integers in MySQL DB

How to use UUIDs instead of integers in MySQL DB Question: I would like to use python’s uuid() function to assign my MySQL id’s instead of just an integer and AUTOINCREMENT. However, it would also be nice if that uuid() was generated when an object is created. I’ve not worked extensively with SQL before. So, …

Total answers: 1

python: how to convert a valid uuid from String to UUID?

python: how to convert a valid uuid from String to UUID? Question: I receive the data as { “name”: “Unknown”, “parent”: “Uncategorized”, “uuid”: “06335e84-2872-4914-8c5d-3ed07d2a2f16” }, and I need to convert the uuid from String to uuid I did not find a way on the python docs, or am I missing something basic here? Asked By: …

Total answers: 4

Convert UUID 32-character hex string into a "YouTube-style" short id and back

Convert UUID 32-character hex string into a "YouTube-style" short id and back Question: I’m assigning all my MongoDB documents a GUID using uuid.uuid1(). I want a way I can derive an 11 character, unique, case-sensitive YouTube-like ID, such as 1_XmY09uRJ4 from uuid’s resulting hex string which looks like ae0a0c98-f1e5-11e1-9t2b-1231381dac60 I want to be able to …

Total answers: 3

How to generate SOPInstance UID for DICOM file?

How to generate SOPInstance UID for DICOM file? Question: I am developing a system which will be able to create structured report for PACS. Obviously in order to create a DICOM instance (file containing Report data), I need three UIDs for Study, Series and Instance. StudyUID and SeriesUID must be the same as that of …

Total answers: 5

How to generate unique 64 bits integers from Python?

How to generate unique 64 bits integers from Python? Question: I need to generate unique 64 bits integers from Python. I’ve checked out the UUID module. But the UUID it generates are 128 bits integers. So that wouldn’t work. Do you know of any way to generate 64 bits unique integers within Python? Thanks. Asked …

Total answers: 5

Python – Why use anything other than uuid4() for unique strings?

Python – Why use anything other than uuid4() for unique strings? Question: I see quit a few implementations of unique string generation for things like uploaded image names, session IDs, et al, and many of them employ the usage of hashes like SHA1, or others. I’m not questioning the legitimacy of using custom methods like …

Total answers: 6

When should I use uuid.uuid1() vs. uuid.uuid4() in python?

When should I use uuid.uuid1() vs. uuid.uuid4() in python? Question: I understand the differences between the two from the docs. uuid1(): Generate a UUID from a host ID, sequence number, and the current time uuid4(): Generate a random UUID. So uuid1 uses machine/sequence/time info to generate a UUID. What are the pros and cons of …

Total answers: 6

How to create a GUID/UUID in Python

How to create a GUID/UUID in Python Question: How do I create a GUID/UUID in Python that is platform independent? I hear there is a method using ActivePython on Windows but it’s Windows only because it uses COM. Is there a method using plain Python? Asked By: Jonathon Watney || Source Answers: The uuid module …

Total answers: 9