uuid

UUID (universally unique identifiers) as specified in RFC 4122.

This module provides the UUID class and the functions uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5 UUIDs respectively.

This module works with Python 2.3 or higher.


Attributes

a NAMESPACE_DNS

UUID('{6ba7b810-9dad-11d1-80b4-00c04fd430c8}')

a NAMESPACE_OID

UUID('{6ba7b812-9dad-11d1-80b4-00c04fd430c8}')

a NAMESPACE_URL

UUID('{6ba7b811-9dad-11d1-80b4-00c04fd430c8}')

a NAMESPACE_X500

UUID('{6ba7b814-9dad-11d1-80b4-00c04fd430c8}')

a RESERVED_FUTURE

'reserved for future definition'

a RESERVED_MICROSOFT

'reserved for Microsoft compatibility'

a RESERVED_NCS

'reserved for NCS compatibility'

a RFC_4122

'specified in RFC 4122'

Functions

f unixgetaddr(program) ...

Get the hardware address on a Unix machine.

f wingetaddr(program) ...

Get the hardware address on a Windows machine.

f getaddr() ...

Get the hardware address as a 48-bit integer.

f uuid1() ...

Generate a UUID based on the time and hardware address.

f uuid3(namespace, name) ...

Generate a UUID from the MD5 hash of a namespace UUID and a name.

f uuid4() ...

Generate a random UUID.

f uuid5(namespace, name) ...

Generate a UUID from the SHA-1 hash of a namespace UUID and a name.

Classes

C UUID(...) ...

Instances of the UUID class represent UUIDs as specified in RFC 4122. Converting a UUID to a string using str() produces a string in the form "{12345678-1234-1234-1234-123456789abc}". The UUID constructor accepts a similar string (braces and hyphens optional), or six integer arguments (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and 48-bit values respectively). UUID objects have the following attributes:

bytes gets or sets the UUID as a 16-byte string

urn gets the UUID as a URN as specified in RFC 4122

variant gets or sets the UUID variant as one of the constants
RESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, RESERVED_FUTURE

version gets or sets the UUID version number (1 through 5)

This class contains 13 members.

See the source for more information.