license-agent-client
A lightweight Python client and FastAPI helpers for enforcing licensing via a local license-agent service.
This package is designed for applications such as Logzy, MeyiConnect, or any product that uses a centralized licensing model:
Application → license-agent → license-platform
It eliminates duplicated license-handling code and provides a single, consistent way to:
- Check license status
- Activate licenses
- Lookup license information
- Enforce license rules at API level
- Keep activation UI accessible while blocking product APIs
Install
Core client (no framework dependency)
pip install license-agent-client
With FastAPI helpers (recommended)
pip install "license-agent-client[fastapi]"
Environment variables
| Variable | Default | Description |
|---|---|---|
| LICENSE_AGENT_URL | http://license-agent:8090 |
Base URL of local license-agent |
| LICENSE_CACHE_SECONDS | 30 |
Cache TTL (seconds) |
| LICENSE_TIMEOUT_SECONDS | 2 |
HTTP timeout |
| REQUIRE_LICENSE | false |
Enable license enforcement |
Core usage (plain Python)
from license_agent_client import get_client, LicenseInactiveError
client = get_client()
try:
client.assert_active()
except LicenseInactiveError as e:
print("License blocked:", e)
raise SystemExit(1)
FastAPI integration
from fastapi import FastAPI
from license_agent_client.router import get_license_router
from license_agent_client.middleware import install_license_gate
app = FastAPI()
app.include_router(get_license_router(prefix="/v1/license"))
install_license_gate(app)
License lifecycle behavior
| Platform action | Agent behavior | App behavior |
|---|---|---|
| Install | pending | blocked |
| Approved | activation allowed | unlocked |
| Deactivated | check-in fails | blocked |
| Rejected | new key allowed | reinstall |
Block APIs when license is inactive (global gate)
from fastapi import FastAPI from license_agent_client.middleware import install_license_gate
app = FastAPI()
install_license_gate( app, exempt_prefixes=( "/ui", "/health", "/v1/license", ), )
Typical FastAPI app layout
from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from license_agent_client.router import get_license_router from license_agent_client.middleware import install_license_gate
app = FastAPI()
Serve activation UI
app.mount("/ui", StaticFiles(directory="/app/ui", html=True))
License APIs
app.include_router(get_license_router(prefix="/v1/license"))
Global license enforcement
install_license_gate(app)
Fetch license limits
limits = get_client().limits() print(limits)
Activate a license (proxy to agent)
from license_agent_client import get_client
resp = get_client().activate( license_key="XXXX-YYYY-ZZZZ", product_code="logzy", fingerprint="node-1", version="1.2.3", vm_meta={"hostname": "prod-node-1"}, )
print(resp)
License info lookup (proxy to agent → platform)
info = get_client().license_info(license_key="XXXX-YYYY-ZZZZ") print(info)
How apps use it (default UI)
from fastapi import FastAPI from license_agent_client.ui import mount_default_ui from license_agent_client.router import get_license_router from license_agent_client.middleware import install_license_gate
app = FastAPI()
mount_default_ui(app) # ✅ mounts built-in /ui app.include_router(get_license_router(prefix="/v1/license")) install_license_gate(app, exempt_prefixes=("/ui", "/health", "/v1/license"))
How apps override it (custom UI)
from fastapi.staticfiles import StaticFiles
override built-in UI
app.mount("/ui", StaticFiles(directory="/app/my-ui", html=True), name="custom-ui")
License
MIT
Metadata
Release files for license-agent-client 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| license_agent_client-1.0.1.tar.gz | 9.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| license_agent_client-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.1 kB
Release files / license_agent_client-1.0.1.tar.gz
| Download URL | license_agent_client-1.0.1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00064a4ef148b874cda7184c220d79a66960951d1e25ec23a3dad87f156de226
|
|
BLAKE2b-256 checksum How to use checksums |
2257b39b96f14747343b719cf7dcfae1f904e0544fa2e134330806d9fe7e317e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / license_agent_client-1.0.1-py3-none-any.whl
| Download URL | license_agent_client-1.0.1-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1642d21b2c6769348a0544bf36d93d8554e5e0b8daacc36f683869d9d213aded
|
|
BLAKE2b-256 checksum How to use checksums |
ae958902033281be3ccaa63424d400e04885f4117eda60dfa69f31016925ba83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Security for license-agent-client 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.