Python software licensing

Python license key validation for desktop apps and CLIs.

Add product-scoped license checks to packaged Python apps, command-line tools, and paid plugins with the GrebKey Python SDK. The SDK supplies a machine fingerprint, local validation cache, and configurable offline grace.

Where the Python SDK fits

Packaged desktop apps

Validate when a PySide, Tkinter, or other packaged Python application starts.

Commercial Python CLIs

Check a product-scoped key before running paid command-line features.

Paid plugins and tools

Use the same validation result for Python-based plugins and developer utilities.

First validation path

  1. Create a GrebKey product and generate a license key for it.
  2. Set GREBKEY_API_URL, GREBKEY_PRODUCT_ID, and GREBKEY_LICENSE_KEY outside your source code.
  3. Call GrebKeyClient.validate() when your Python application starts.
  4. Allow paid behavior only when the result is valid and this machine is activated.

Runnable Python quickstart

This public quickstart covers environment configuration, SDK validation, and the valid plus machine-activated decision. Save it as first_validation.py, provide the three environment variables, and run it where you installed grebkey.

pip install grebkey

import os
from grebkey import GrebKeyClient, GrebKeyError

client = GrebKeyClient(
    api_url=os.environ["GREBKEY_API_URL"],
    product_id=os.environ["GREBKEY_PRODUCT_ID"],
)

try:
    result = client.validate(os.environ["GREBKEY_LICENSE_KEY"])
except GrebKeyError:
    print("License validation could not be completed.")
    raise SystemExit(1)

if result.valid is not True or result.machine_activated is not True:
    print(f"Not licensed: {result.reason or 'machine_not_activated'}")
    raise SystemExit(1)

print("Licensed!")

python first_validation.py

Activation, cache, and offline boundaries

  • Validation checks this machine but does not activate it.
  • Activation can require a gk_live_ API key and belongs in trusted server-side code. Never ship a GrebKey API key inside distributed software.
  • A cached result may be reused during a network failure while it is inside the configured grace period.
  • The from_cache result tells you that cache was used, but it does not distinguish a fresh cache hit from offline-grace fallback.

Continue your integration