Python uuid.NAMESPACE_DNS Examples
The following are 6
code examples of uuid.NAMESPACE_DNS().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
uuid
, or try the search function
.
Example #1
Source File: test_column.py From AnyBlok with Mozilla Public License 2.0 | 5 votes |
def test_uuid_binary_3(self): from uuid import uuid3, NAMESPACE_DNS uuid = uuid3(NAMESPACE_DNS, 'python.org') registry = self.init_registry(simple_column, ColumnType=UUID) test = registry.Test.insert(col=uuid) assert test.col is uuid
Example #2
Source File: test_column.py From AnyBlok with Mozilla Public License 2.0 | 5 votes |
def test_uuid_binary_5(self): from uuid import uuid5, NAMESPACE_DNS uuid = uuid5(NAMESPACE_DNS, 'python.org') registry = self.init_registry(simple_column, ColumnType=UUID) test = registry.Test.insert(col=uuid) assert test.col is uuid
Example #3
Source File: views.py From troupon with MIT License | 5 votes |
def generate_unique_code(self, deal, user): """ Generates Tickets for virtual deals Arguments: deal -- object representing the deal being purchased user -- object representing customer Returns: filename -- name of the file where QR code is stored id -- unique ID generated for this transaction """ # Converts utf8 to ascii strings because that is what UUID works with merchant_name = deal.advertiser.name.encode("utf8") deal_name = deal.advertiser.name.encode("utf8") username = user.username.encode("utf8") # Generates a unique code with python's UUID library # and embed in qrcode ticket_id = uuid.uuid5( uuid.NAMESPACE_DNS, merchant_name + deal_name + username ) qr = qrcode.QRCode( version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=4, ) qr.add_data(ticket_id) qr.make(fit=True) img = qr.make_image() output = StringIO.StringIO() img.save(output, 'PNG') img = output.getvalue().encode("base64") output.close() return img, ticket_id
Example #4
Source File: kodicast.py From script.tubecast with MIT License | 5 votes |
def generate_uuid(): friendly_name = 'device.tubecast.{}'.format(Kodicast.friendlyName) if not PY3: friendly_name = friendly_name.encode('utf8') Kodicast.uuid = str(uuid.uuid5( uuid.NAMESPACE_DNS, friendly_name))
Example #5
Source File: option_owners.py From polyaxon with Apache License 2.0 | 5 votes |
def __str__(self): return uuid.uuid5( namespace=uuid.NAMESPACE_DNS, name=f"user<{self.user}>:" f"project<{self.project}>:" f"team<{self.team}>:" f"organization<{self.organization}>", ).hex
Example #6
Source File: volumes.py From polyaxon with Apache License 2.0 | 5 votes |
def get_volume_name(path: str) -> str: name = uuid.uuid5(namespace=uuid.NAMESPACE_DNS, name=path).hex return constants.CONTEXT_VOLUME_CONNECTIONS_FORMAT.format(name)