Skip to main content

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

api_key = os.environ.get('KEYMINT_API_KEY')
product_id = os.environ.get('KEYMINT_PRODUCT_ID')

if not api_key or not product_id:
    raise ValueError('Please set the KEYMINT_API_KEY and KEYMINT_PRODUCT_ID environment variables.')

sdk = KeyMint(api_key)

# 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.
floating_checkout Checks out a floating license seat.
floating_heartbeat Sends a heartbeat to keep a session alive.
floating_checkin Checks in a session, releasing the seat.

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.

Webhook Verification

Method Description
verify_webhook_signature Verifies the signature of a webhook request payload.

Idempotency

All mutating SDK methods support idempotency keys to safely retry requests in case of network drops. Pass a unique string (recommended: UUID v4) as the optional idempotency_key keyword argument:

result = sdk.create_key({ 
    'productId': product_id,
}, idempotency_key='9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d')

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

keymint-2.3.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keymint-2.3.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file keymint-2.3.0.tar.gz.

File metadata

  • Download URL: keymint-2.3.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for keymint-2.3.0.tar.gz
Algorithm Hash digest
SHA256 22f8ac05bf32057c587ad3079b5b0429d8fc30ac32e352e01c0bb168cc318601
MD5 82e17a1c464c7a779c5784895fada620
BLAKE2b-256 8fe6abad16b79575110d11e7ecf6603be02113e3fbbaa10f823e92403c7ed7d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for keymint-2.3.0.tar.gz:

Publisher: ci-cd.yml on keymint-dev/Keymint-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file keymint-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: keymint-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for keymint-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2747d1ec4f5649c0910818c42e2fadabe3a7522b5230fb0a78af84672d541127
MD5 acb3dcbf13b4700c3c4d2a55328a67b1
BLAKE2b-256 d9e9be571251fc09a48c6ca7fa8de346f18a858019d0fd7e07e658f7e44321bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for keymint-2.3.0-py3-none-any.whl:

Publisher: ci-cd.yml on keymint-dev/Keymint-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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