Skip to main content

Client and manager helpers for CyberLicensing

Project description

CyberLicensing Python SDK

Utilities for integrating with the CyberLicensing service.

Installation

For now, install directly from the project root:

pip install cyberlicensing

Client-side usage

from cyberlicensing import LicenseClient

client = LicenseClient(
    base_url="https://licensing.showdown.boo",
    project_id=1,
)
result = client.validate_with_environment("LICENSE-KEY-1234")
print(result)

validate_with_environment automatically gathers HWID/IP metadata and sends it along with the required project_id. Use validate_license if you want to provide your own context.

The request body sent to the public endpoint /api/validate_license is compatible with the API contract:

{
  "project_id": 1,
  "key": "LICENSE-KEY-1234",
  "hwid": "unique-hardware-id",
  "metadata": {
    "plan": "enterprise",
    "seats": 10
  }
}

Client-editable metadata

Project managers can flag metadata fields as client_editable in the schema so that end-users can modify a limited subset of fields from the public client. Only those fields are accepted when calling LicenseClient.validate_license(..., metadata=...) or the dedicated helper LicenseClient.update_client_metadata.

Example workflow:

  1. A project manager defines the schema field and marks it as client-editable.
  2. The client application updates the metadata from the end-user device.
from cyberlicensing import ManagerClient, LicenseClient

# Manager side: ensure the metadata schema declares client-editable fields
manager = ManagerClient(base_url="https://licensing.showdown.boo")
manager.authenticate("admin", "password")
manager.update_metadata_schema(
  project_id=1,
  fields=[
    {"name": "notes", "type": "string", "client_editable": True},
  ],
)

# Client side: update metadata for a specific license key
client = LicenseClient(base_url="https://licensing.showdown.boo", project_id=1)
client.update_client_metadata(
  key="CL-XXXX-XXXX",
  metadata={"notes": "Nouvelle machine"},
)

Manager-side usage

from cyberlicensing import ManagerClient

manager = ManagerClient(base_url="https://licensing.showdown.boo")
manager.authenticate("admin", "password")
projects = manager.list_projects()
project_id = projects[0]["id"]
license_data = manager.create_license(
    project_id,
    days_valid=30,
    metadata={"plan": "pro"},
)

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

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.5.tar.gz (6.2 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.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cyberlicensing-0.2.5.tar.gz
  • Upload date:
  • Size: 6.2 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.5.tar.gz
Algorithm Hash digest
SHA256 ae3e7481cee5cd856bfec7903c1fd4b290ffcbad3e74ae1abddf65ff35c29270
MD5 9dfcca9c3eab41940b0636fbbe6b915f
BLAKE2b-256 77207f52c2c36002bd1ad38e5fa7bf97d99fc535ab113394734236bf3dd9430d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cyberlicensing-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 7.7 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3c4c29b8ddff26855ce298281253f96dc3aa10c710436b41ce210cff01a1e36a
MD5 8761a1397f1222705f18b8aed828423d
BLAKE2b-256 0f5ac9f9bbe9e978ee246b3847a1b2e66b56f5c957640956fc1a87c6c03d7a93

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