Skip to main content

Python client for the Keyva.dev license management API

Project description

Keyva Python Client

A Python client for interacting with the Keyva.dev license management API.

Installation

pip install keyva-client

Usage

1. Initialize the Client

from keyva import KeyvaClient

client = KeyvaClient("YOUR_API_KEY", public_key="YOUR_EdDSA_PUBLIC_KEY")

2. Validate a License

result = client.validate("LICENSE_KEY", release="1.0.0")
print("Valid:", result["valid"])

# Verify the signed token
if result.get("valid") and result.get("token"):
    decoded = client.verify_token(result["token"])
    print("Decoded:", decoded)

3. Create a License

license = client.create_license(
    "PRODUCT_ID",
    duration="1y",  # or expires_at="2027-12-31T23:59:59Z"
    feature_codes=["PRO", "ANALYTICS"],
    allowed_ips=["192.168.1.1"],
    release_versions=["1.0.0", "1.1.0"],
)
print("Created:", license)

4. Update a License

updated = client.update_license(
    "LICENSE_KEY",
    feature_codes=["PRO", "ANALYTICS", "TEAMS"],
    duration="30d",
)
print("Updated:", updated)

5. Activate a License

activated = client.activate_license("LICENSE_KEY", duration="14d")
print("Activated:", activated)

6. Revoke a License

revoked = client.revoke_license("LICENSE_KEY")
print("Revoked:", revoked)

7. Delete a License

deleted = client.delete_license("LICENSE_KEY")
print("Deleted:", deleted)

Error Handling

All methods raise KeyvaError on non-2xx responses:

from keyva import KeyvaClient, KeyvaError

try:
    result = client.validate("BAD_KEY")
except KeyvaError as e:
    print(f"Error {e.status_code}: {e}")

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

keyva_client-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

keyva_client-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file keyva_client-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for keyva_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4448327a8a6ae5bd740d8abaaf26b11a3849f518e402520e386854c07ab09fb5
MD5 51401fb21f52e86ad4d2f572e253a71d
BLAKE2b-256 eb6d36aa002ac24bdd304290f2a597b222172367b49dc1fada1d4d6821f70af1

See more details on using hashes here.

Provenance

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

Publisher: publish-python.yml on KubiqIO/keyva-clients

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

File details

Details for the file keyva_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: keyva_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for keyva_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccf6bb6a15f7e7e7c65ae564ca1f7dd10c36d39e09b804aec29963c52100545c
MD5 92006854bf2634107a6bc8df526e5df6
BLAKE2b-256 e9d0b46595df72010844f65a5e8143d2b5db4e642885452c826254c4970af03d

See more details on using hashes here.

Provenance

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

Publisher: publish-python.yml on KubiqIO/keyva-clients

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