Python SDK

Official SDKs

Python SDK

Pure Python 3.8+. Basic online requests use the standard library. Install permitcore[offline] for signed offline/grace verification.

Installation

pip
pip install "permitcore[offline]"

Quick start

Python
from permitcore import PermitCoreClient

client = PermitCoreClient("https://api.permitcore.dev")
result = client.validate("PERMIT-XXXX-XXXX-XXXX-XXXX")

if not result.is_valid:
    print(f"License invalid: {result.message}")
    raise SystemExit(1)

# Feature flags
if result.has_feature("export"):
    enable_export()
if result.is_trial:
    print(f"Trial — {result.trial_days_remaining} days remaining")

# Warn if vendor subscription expiring
if result.vendor_warning:
    show_warning(result.vendor_warning)

Activation

Python
import socket
result = client.activate(
    "PERMIT-XXXX-XXXX-XXXX-XXXX",
    device_id   = PermitCoreClient.get_hardware_id(),  # auto if omitted
    device_name = socket.gethostname()
)
if result.is_valid:
    save_activated()

Offline mode

Python
# Cache is enabled by default — stored in ~/.permitcore_cache_{hash}
client = PermitCoreClient(
    "https://api.permitcore.dev",
    enable_offline_cache=True
)
result = client.validate(key)
if result.is_offline:
    print("Running in offline mode")

Floating licenses

Check out a seat when the session starts. While running, heartbeat about every four minutes and handle failed heartbeats. Stop using a rejected session. Cancel the heartbeat loop and await checkin during normal shutdown; process-exit callbacks may not finish network calls. See floating-session lifecycle.

Hardware ID

Python
hwid = PermitCoreClient.get_hardware_id()
# "a3f82c91b44e..." — stable SHA-256 of machine identifiers