Skip to main content

Client and manager helpers for CyberLicensing

Project description

CyberLicensing Python SDK

Client and manager helpers for integrating public validation flows and project operations with the CyberLicensing API.

License client – validates license keys, collects environment metadata and lets end-users update client_editable fields. Manager client – handles authentication plus CRUD operations for projects, metadata schemas and licenses. Environment helpers – gather HWID, local/public IPs and other contextual information in one call.

The SDK targets Python 3.9+ and is published to PyPI as cyberlicensing.

Installation

pip install cyberlicensing

Quick start

Validate a license key

from cyberlicensing import LicenseClient

client = LicenseClient(
  base_url="https://licensing.showdown.boo",
  project_id=42,
)

# Automatically collects HWID, LAN/public IP, etc.
result = client.validate_with_environment("CL-XXXX-XXXX")
print(result)

To control the payload manually, call validate_license and pass hwid, ip, and metadata yourself. The metadata must only contain fields that are marked client_editable in your project schema.

Manage projects and licenses

from cyberlicensing import ManagerClient

manager = ManagerClient(base_url="https://licensing.showdown.boo")
manager.authenticate("admin", "password")

# Create project and create license
project = manager.create_project("My Awesome App")
license_data = manager.create_license(
  project_id=project["id"],
  days_valid=30,
  metadata={"plan": "pro"},
)

# Revoke a license
manager.update_license(
    license_id=license_data["id"],
    is_active=False,
    metadata={"plan": "revoked", "notes": "Chargeback"},
)

# Update a license
manager.update_license(
  license_id=license_data["id"],
  metadata={"plan": "enterprise", "notes": "Upgraded"},
)

More helpers are exposed for listing projects/licenses, extending expirations, resetting HWIDs, or deleting keys entirely.

Client-editable metadata workflow

Certain metadata fields can be safely mutated by the end-user thanks to the client_editable flag defined in the project schema.

  1. Manager defines the schema:
from cyberlicensing import ManagerClient

manager = ManagerClient(base_url="https://licensing.showdown.boo")
manager.authenticate("admin", "password")

manager.update_metadata_schema(
  project_id=42,
  fields=[
    {"name": "notes", "type": "string", "client_editable": True},
    {"name": "plan", "type": "string", "client_editable": False},
  ],
)
  1. Client updates the editable fields:
from cyberlicensing import LicenseClient

client = LicenseClient(base_url="https://licensing.showdown.boo", project_id=42)

client.update_client_metadata(
  key="CL-XXXX-XXXX",
  metadata={"notes": "Nouvelle machine"},
)

update_client_metadata validates locally that project_id is an int and the metadata dictionary is non-empty before calling POST /api/client_metadata. Server responses bubble up any JSON msg errors through ApiError for easier debugging (e.g., non editable field, inactive key, etc.).

Environment helpers

from cyberlicensing import collect_environment_metadata

print(collect_environment_metadata())

The helper returns HWID, hostname, LAN IP, optional public IP, and other useful attributes. Use it to enrich validate_license calls or to store telemetry on validated machines.

Error handling

  • ApiError(status_code, message, payload) – raised when the API returns HTTP ≥ 400. The message will prefer the backend msg property if present.
  • AuthenticationError – surfaces authentication/authorization issues in manager flows.
  • CyberLicensingError – base class for all SDK exceptions for easy broad exception handling.
from cyberlicensing import ApiError

try:
  client.validate_license("INVALID")
except ApiError as exc:
  print(exc.status_code, exc)
  print(exc.payload)

Local development

python -m venv .venv
.venv\Scripts\activate
pip install -e .
python -m build

Additional helpers:

  • list_licenses(project_id) – list all licenses (keys + live metadata and usage counters) for a project
  • create_license(project_id, days_valid=None, metadata=None) – generate a new license key
  • update_license(license_id, is_active=None, expires_at=None, reset_hwid=False, metadata=None) – ban/disable, move expiration, reset HWID, or overwrite metadata
  • extend_license(project_id, license_id, days) – convenience method to push expiration forward
  • delete_license(license_id) – hard-delete a key

Environment helpers

from cyberlicensing import collect_environment_metadata

print(collect_environment_metadata())

Returns HWID, hostname, LAN IP, and (if available) public IP.

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

cyberlicensing-0.2.6.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.

cyberlicensing-0.2.6-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file cyberlicensing-0.2.6.tar.gz.

File metadata

  • Download URL: cyberlicensing-0.2.6.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for cyberlicensing-0.2.6.tar.gz
Algorithm Hash digest
SHA256 c3d5d3051a41a847fc1f27f3a0d1689b8e291e0ada7e1483938693355dc532f0
MD5 8af37f2667de36d588da717060c4234e
BLAKE2b-256 ce32d15f75a3392b9d62d28c2c72e3d094f6eeacb9419e012a6b2f1cf0afc9fe

See more details on using hashes here.

File details

Details for the file cyberlicensing-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: cyberlicensing-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for cyberlicensing-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1e09e15ef35fc8f7c699830614e7d452df8576ac82728345dd0a88a46a7066fc
MD5 0559cb386a0a8225c477807205f4cceb
BLAKE2b-256 45d57889d3fe99e953e53144cbf556d83416d838b3ed92b4b6e4333938b60af4

See more details on using hashes here.

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