niiko/developers

Packages Python Latest 0.1.0

niiko

The Python client. Dataclasses per action and per read, and a Result with the outcomes, zero dependencies.

Last updated

Runtime
Python 3.10+
License
Apache-2.0
Source
vorluno/niiko-sdk-python
Registry
pypi.org/project/niiko/

Install

pip install niiko

Use

Dataclasses per action and per read, and a Result with the outcomes. Pass access_token= to read. Zero dependencies: urllib ships with Python.

pip install niiko

import os, uuid
from niiko import Niiko, CreateLeadInput

niiko = Niiko(api_key=os.environ["NIIKO_API_KEY"])

r = niiko.create_lead(
    CreateLeadInput(
        submissionId="01890a5d-ac96-774b-bcce-b302099a8057",
        source="web_form",
    ),
    idempotency_key=str(uuid.uuid4()),  # keep it if you retry
)

if r.status == "done":
    print(r.output)
elif r.status == "refused":
    print(r.reason, (r.detail or {}).get("message"))
Two permissions, not one

Both are needed: a key with that scope, and the workspace owner having switched the permission on. Holding the key is not enough — they are two decisions made by different people.

What it does not do

  • Validate your input — the server does, and its refusal travels with a name.
  • Read tables — only the declared reads, each with its contract, and only with an OAuth token.

Versions

Every version published to the registry, newest first, with the moment it became installable. Each one has its own page.