Skip to main content

Python SDK for licensekit.dev

Project description

licensekit-sdk

Public Python SDK source for licensekit.dev.

This repository is the standalone home of the PyPI package licensekit-sdk. It contains the published client source, examples, tests, and the OpenAPI snapshot used to generate the typed client surface.

Links:

  • product site: https://licensekit.dev
  • hosted API: https://api.licensekit.dev
  • TypeScript SDK: https://www.npmjs.com/package/@licensekit/sdk

Install

pip install licensekit-sdk

Quick Start

from licensekit import (
    ManagementClient,
    PublicKeyStore,
    RuntimeClient,
    SystemClient,
    verify_runtime_result,
)

base_url = "https://api.licensekit.dev"

system = SystemClient(base_url=base_url)
health = system.health()
print(health["data"]["status"])

management = ManagementClient(
    base_url=base_url,
    token="lkm_..."
)

product = management.create_product(
    body={
        "name": "Example App",
        "code": "example-app",
    }
)

runtime = RuntimeClient(
    base_url=base_url,
    license_key="lsk_..."
)

result = runtime.validate_license(
    body={
        "fingerprint": "host-123",
    }
)

public_keys = system.list_public_keys()
verified = verify_runtime_result(
    result,
    PublicKeyStore(public_keys["data"]),
)

print(product["data"]["id"], verified.ok)

Package Shape

  • ManagementClient Uses Authorization: Bearer <token> for /api/v1/... management operations.
  • RuntimeClient Uses Authorization: License <license-key> for /api/v1/license/... runtime operations.
  • SystemClient Unauthenticated access to /health, /healthz, /readyz, /metrics, and /api/v1/system/public-keys.

Hosted deployments should prefer /health for liveness checks behind api.licensekit.dev. /healthz remains available for local and self-hosted compatibility.

Scope Metadata

from licensekit import get_required_scopes, has_required_scopes

scopes = get_required_scopes("createProduct")
allowed = has_required_scopes("createProduct", ["product:write"])

Raw Response Access

Each client exposes a .raw companion for callers that need status codes and headers.

from licensekit import SystemClient

system = SystemClient(base_url="https://api.licensekit.dev")
ready = system.raw.readyz()

print(ready.status, ready.data["data"]["status"])

Examples

Examples live in examples/:

  • 01_create_scoped_api_key.py
  • 02_runtime_validate_and_verify.py

Development

python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
python scripts/generate_from_openapi.py
pytest
python -m build

Generation uses the checked-in OpenAPI snapshot at openapi/openapi.yaml.

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

licensekit_sdk-0.1.0a0.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

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

licensekit_sdk-0.1.0a0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file licensekit_sdk-0.1.0a0.tar.gz.

File metadata

  • Download URL: licensekit_sdk-0.1.0a0.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for licensekit_sdk-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 9d08d74b70469fc30e53fffd294048faa9f1bc6072c31af36840775fbb168a8e
MD5 7a5af5e8403a11a8e45bdad8114946f8
BLAKE2b-256 0d547436a5c46807424f532a11977effbaac0f20693d91b23bae6f851ecb48c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for licensekit_sdk-0.1.0a0.tar.gz:

Publisher: release.yml on drmain1/licensekit-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 licensekit_sdk-0.1.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for licensekit_sdk-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 a090732ae968f03a6239d04c5bdf3fe25ed4cb4a890284a5f09586230eeb0fdf
MD5 ab561b63f12eff9bc09ad5dd37420372
BLAKE2b-256 2889761204b08a06e1e17c029bab9d663cd72dafd9020cebd5c625f55e872226

See more details on using hashes here.

Provenance

The following attestation bundles were made for licensekit_sdk-0.1.0a0-py3-none-any.whl:

Publisher: release.yml on drmain1/licensekit-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