Python Client
Python client SDK for the License Server gRPC API.
Installation
Section titled “Installation”pip install -e .For development dependencies:
pip install -e ".[dev]"Quick Start
Section titled “Quick Start”from license_client import LicenseClient, ClientConfig
config = ClientConfig( server_addr="localhost:9090", license_key="YOUR-LICENSE-KEY",)
with LicenseClient(config) as client: # Validate license result = client.validate() if result.valid: print(f"License valid until {result.expires_at}") for ent in result.entitlements: print(f" {ent.code}: {ent.name}") else: print(f"Validation failed: {result.error_message}")mTLS Configuration
Section titled “mTLS Configuration”from license_client import LicenseClient, ClientConfig, TLSConfig
config = ClientConfig( server_addr="license.example.com:9090", license_key="YOUR-KEY", tls=TLSConfig( cert_file="client.crt", key_file="client.key", ca_file="ca.crt", ),)Features
Section titled “Features”- License validation with metadata
- Device activation / deactivation
- Heartbeat (manual)
- Usage reporting and status
- mTLS support
- Grace period token caching
- Hardware ID generation (compatible with Go client)
- Context manager support
Development
Section titled “Development”make deps # Install dev dependenciesmake test # Run testsmake lint # Run lintersmake proto # Regenerate protobuf stubsProto Generation
Section titled “Proto Generation”The generated stubs are located at src/license_client/gen/license/v1/. To regenerate:
make protoThis requires grpcio-tools, which is installed with the dev dependencies.
Running Examples
Section titled “Running Examples”export LICENSE_SERVER_ADDR="localhost:50090"export LICENSE_KEY="YOUR-LICENSE-KEY"uv run python -m examples.basic_validation --server $LICENSE_SERVER_ADDR --key $LICENSE_KEY