Python license key system
A single file plus one small dependency (the widely used cryptography package, for signature checks): activate on first run, verify on every run after, and stay running through short outages.
License checking in a few lines
from license_client import LicenseClient
client = LicenseClient(
base_url="https://license.foliox.sbs",
product="my-tool",
public_key_b64=PUBLIC_KEY, # from /api/v1/public-key
)
# activates on first run, verifies on every run after
result = client.check(license_key)
if not result.valid:
raise SystemExit(f"Not licensed: {result.reason}")
Get started
- Create a free account, add a product, and generate a key.
- Get the Python client and its full guide: Python SDK docs.
- Copy the public key from
/api/v1/public-keyinto your app — the SDK uses it to verify every answer. - Call
check()with the customer’s key as shown above.
Why this SDK
- Works with plain scripts, CLI tools and desktop apps; install its one dependency with pip install cryptography.
- Computes the hashed machine ID for you on Windows, Linux and macOS.
- Caches the last signed “valid” answer so a short outage never locks a paying user out.
Prefer plain HTTP? See the licensing API and the API reference. Device locking works through a hashed machine ID — here’s how.
Python licensing questions
How do I add license keys to a Python app?
Copy the Python client file into your project, create a product in your dashboard, generate keys, and call check() with the customer’s key when your app starts. The SDK activates the key on first run and verifies it after that.
What happens when the customer is offline?
The client caches the last signed “valid” answer and keeps your app running for up to 72 hours. Because the cache is signed, it can’t be edited by hand.
Is the SDK free?
Yes — all SDKs are included on every plan, including Free.
Related
Ready to license your software?
Create a free account, generate your first keys and drop in an SDK — it takes a few minutes.