Installation
Setup and usage
Initialize the client
Import KeyPort and create a client with your API key, or load it from a config file:from keyport import KeyPort
client = KeyPort(api_key='kp_live_xxx')
Validate a license key
Call client.validate with the license key you want to check:result = client.validate('ABCD-EFGH-IJKL-MNOP')
This sends a POST /api/v1/validate request and returns the validation result. Retrieve license details
Call client.get_license with the license key to fetch full license details:detail = client.get_license('ABCD-EFGH-IJKL-MNOP')
This sends a GET /api/v1/license/:key request and returns the license detail object.
Full examples
from keyport import KeyPort
client = KeyPort(api_key='kp_live_xxx')
# Validate a license key
result = client.validate('ABCD-EFGH-IJKL-MNOP')
# Retrieve full license details
detail = client.get_license('ABCD-EFGH-IJKL-MNOP')
Store your API key in an environment variable or a keyport.json config file rather than hard-coding it in your source code.