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.

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.2.0.tar.gz (11.3 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.2.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for keymint-2.2.0.tar.gz
Algorithm Hash digest
SHA256 ab741b8005f6b9fa54e9be11ee56d9c54be844dd673e77f55bf2d72a3855c846
MD5 35db562fda007c05346181952d77d660
BLAKE2b-256 86e26bd22c79508a3555dc98e4a0a928f5482e08d71d16aa1ee5b1158dac2080

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: keymint-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 222a8343ebf92655e19984fb83df72deefbbea23e332ecd93fc18f88b394eb73
MD5 ce831a201a985630515aa51f9a38bd9c
BLAKE2b-256 5aaa7660e8b1111edf877233452b3533878718da89f891856f87817497451d3a

See more details on using hashes here.

Provenance

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