Add licensing to a Python app
Use the application client for your Python app. Vendor-server operations use the separate backend helper.
This preview supports Windows x64.
1. Install
Install the PyPI preview with Python 3.10 or later:
python -m pip install --only-binary=:all: "permitplane-client==0.1.0a1"2. Connect your product
On your PermitPlane product page, click Download permitplane.json and Create test key. Bundle the configuration beside your application's entry file:
from pathlib import Path
from permitplane import PPLicense
PPLicense.initialize(config_path=Path(__file__).resolve().with_name("permitplane.json"))3. Check a feature
if PPLicense.is_licensed("export"):
print("Export is enabled")
else:
print("Choose a licence to enable export")Checks use the saved signed licence offline. A due refresh can make a synchronous network request; run that check outside your GUI event thread.
4. Activate and close
Ask for the customer's licence key once, then activate it:
from getpass import getpass
PPLicense.activate(getpass("Licence key: "))
print(PPLicense.status())
PPLicense.shutdown()The Windows host protects the installation key and saved state for the signed-in Windows user. Restarting your app restores its licence. Use PPLicense.client() for hosted trial approval, enrollment, offline exchange and floating seats. Your application schedules seat renewal from the client's heartbeat_in_seconds status and releases its seat when work ends.