Skip to main content

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.

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.1.tar.gz (11.8 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.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for keymint-2.3.1.tar.gz
Algorithm Hash digest
SHA256 c8784233d576d263d277af788b71e91f3f8e50f1fbe72dca2e53edb4320bf245
MD5 d2db4a3324f185935053f8805166103d
BLAKE2b-256 567dea004df03eed0107dd09df73720b557ea15c0e70e52d162fbcdd77b1eb6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for keymint-2.3.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: keymint-2.3.1-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.14

File hashes

Hashes for keymint-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c0046ee767503c4e27a7b584f3c81ed21a37d281c35ff74bec8bf885138f52ba
MD5 cd9568ecb72619ea89f35381adb9f1cd
BLAKE2b-256 b47a4a97002933aef76f9ad16b8940bfb65f4d006aa719f4ae12404f89949c5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for keymint-2.3.1-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.

Release history Release notifications | RSS feed

2.4.0

2 files

This release

2.3.1 This release

2 files

2.3.0

2 files

2.2.0

2 files

2.1.1

2 files

2.1.0

2 files

2.0.1

2 files

2.0.0

2 files

1.0.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page