Official Python SDK for KeyMint license management with comprehensive API coverage.
Project description
Keymint Python
A professional, production-ready SDK for integrating with the Keymint API in Python. Provides robust access to all major Keymint features, with type hints and modern error handling.
Features
- Type hints: Full type hint support for better IDE integration and code safety.
- Comprehensive: Complete API coverage for all Keymint endpoints.
- Consistent error handling: All API errors are returned as structured objects or exceptions.
- Machine Identity: Built-in utilities for hardware fingerprinting and stable installation IDs.
Installation
Add the SDK to your project:
pip install keymint
Usage
import os
from keymint import KeyMint, identity
access_token = os.environ.get('KEYMINT_ACCESS_TOKEN')
product_id = os.environ.get('KEYMINT_PRODUCT_ID')
if not access_token or not product_id:
raise ValueError('Please set the KEYMINT_ACCESS_TOKEN and KEYMINT_PRODUCT_ID environment variables.')
sdk = KeyMint(access_token)
# 1. Get a stable, unique ID for this machine
host_id = identity.get_or_create_installation_id()
# 2. Create a key authorized only for this machine
result = sdk.create_key({
'productId': product_id,
'allowedHosts': [host_id]
})
if result and 'key' in result:
print(f"Created Key: {result['key']}")
Machine Identity
Keymint provides utilities to uniquely identify machines for node-locking:
identity.get_or_create_installation_id(): Recommended. Generates a stable UUID anchored to hardware and persists it to~/.keymint/installation-id.identity.get_machine_id(): Generates a SHA-256 fingerprint based on BIOS UUID, OS machine ID, and MAC address.
API Methods
License Key Management
| Method | Description |
|---|---|
create_key |
Creates a new license key. |
activate_key |
Activates a license key for a device. |
deactivate_key |
Deactivates a device from a license key. |
get_key |
Retrieves detailed information about a key. |
block_key |
Blocks a license key. |
unblock_key |
Unblocks a previously blocked license key. |
Customer Management
| Method | Description |
|---|---|
create_customer |
Creates a new customer. |
get_all_customers |
Retrieves all customers. |
get_customer_by_id |
Gets a specific customer by ID. |
get_customer_with_keys |
Gets a customer along with their license keys. |
update_customer |
Updates customer information. |
toggle_customer_status |
Toggles customer active status. |
delete_customer |
Permanently deletes a customer and their keys. |
License
MIT
Support
For help, see Keymint API docs or open an issue.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file keymint-2.1.1.tar.gz.
File metadata
- Download URL: keymint-2.1.1.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a14a30fe65ed0db63e400124a15d32bb93b4bfd10fe1647bef6207aea72fac5
|
|
| MD5 |
77ca466da03c24759b815fa5cf4872a8
|
|
| BLAKE2b-256 |
3d55d44baf2ffbf4ebf42ef46dd60b5586fb614bea13ea6c7208894855652595
|
File details
Details for the file keymint-2.1.1-py3-none-any.whl.
File metadata
- Download URL: keymint-2.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d453d2836fe2e9d33eb6b8c74e227e04d6b6770794410db8c944574dde1cc0e
|
|
| MD5 |
efbb9e12910ef3c435550d8ceeac0faa
|
|
| BLAKE2b-256 |
a975e14cb5c5da964ddb6758c71274b71d313aed953e6cfc0eba67ef7b06cc3f
|