-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Goal
Build a Python SDK package (permit-sdk) providing a typed API wrapper for the permit backend, with built-in retries, timeout handling, and error mapping. Customers import permit_sdk and call activate() and get_status() without managing HTTP details.
Requirements
Functional
-
PermitClient(api_key, api_url)initialization. -
client.activate(license_key, device_fingerprint)→ returns session token and policy snapshot. -
client.get_status(session_token)→ returns status enum (ACTIVE,GRACE,EXPIRED,REVOKED). - Retry on HTTP 5xx or timeout: up to 3 retries with exponential backoff (100ms, 200ms, 400ms).
- Map API error codes to typed exceptions:
ActivationError,SessionExpiredError,LicenseRevokedError.
Technical
- Python: 3.11+.
- Dependencies:
httpx,pydantic. - Auth: API key in header
Authorization: ApiKey {api_key}. - Timeout: 30 seconds per request.
- Async:
httpx.AsyncClientfor async variant (activate_async()). - Package: PyPI-ready structure under
sdk/.
Acceptance Criteria
-
activate()returns session token on success. -
activate()raisesActivationErroron 4xx. - Retries 3 times on 5xx before raising.
- Async variant works with
await client.activate_async(...).
Dependencies
- Blocked by: Issue 06: JWT Authentication #6, Issue 11: Create License Endpoint #11, Issue 17: Activation Eligibility Validation #17, Issue 18: Activation Session Creation and Device Binding #18.
- Blocks: Issue 24: SDK Heartbeat Loop and State Machine #24, Issue 25: SDK Test Suite #25, Issue 27: SDK Demo Application #27.
Reactions are currently unavailable