Skip to main content

A Simple package to generate and validate UUID and API key pairs

Project description

pyuuidapikey

A Simple package to generate and validate uuid and apikey key pairs

Install

pip install pyuuidapikey

Example

Generate Keys

from pprint import pprint
from pyuuidapikey import UUIDAPIKey

uuidapikey = UUIDAPIKey()

keys: dict = uuidapikey.generate()
pprint(keys)

Output

{
	'apikey': 'TPICACD6-W97D3LB1-473P6SN5-1VNG9X4J',
	'uuid': '95f0aac2-3681-4ab1-89a2-6ea5614a191f'
}

Validate Keys

from pyuuidapikey import UUIDAPIKey

apikey: str = 'TPICACD6-W97D3LB1-473P6SN5-1VNG9X4J'
uuid: str = '95f0aac2-3681-4ab1-89a2-6ea5614a191f'

uuidapikey = UUIDAPIKey()

is_valid: bool = uuidapikey.validate(apikey, uuid)
print(is_valid)

Output

True

Inspired the works from the JS library,

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyuuidapikey-0.0.3.tar.gz (3.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page