Test mode: paid plans aren't on sale yet, so nothing is charged. Every plan's limits apply.

← Docs

Nod management API for Python

A client for each realm's management API (<issuer>/api/v1), standard library only: nothing to install beside it. Python 3.9 or later.

from nod_management import Management, NodError

m = Management("https://auth.example.com/acme", client_id="ops", client_secret=SECRET)

alice = m.users.create("alice", email="alice@example.com")
m.organizations.add_member("initech", alice["id"])
for u in m.users.all():                       # follows the cursor for you
    print(u["username"])
for e in m.logs.all(type="signin.failure"):   # the security log, oldest first
    print(e["time"], e.get("username"), e.get("ip"))

try:
    m.users.create("x")
except NodError as e:
    print(e.status, e.error, e.description)

Tests run the client against a real server on a throwaway PostgreSQL: python3 -m unittest discover -v -s tests -t . (set HARPORA_BIN or NOD_BIN to use an already built harpora); python3 -m unittest -v tests.test_offline needs no server. Not published yet: publishing under a package name is a person's decision.

Billing

m.billing covers plans (plans, plan, set_plan, delete_plan, add_price), an organization's state (organization, set_organization; a PUT older than the stored as_of_ms answers "stale": True), the customer list (organizations for a page, all_organizations for every page), checkout, portal and sync (health).

m.billing.set_plan("pro", ["sso", "audit_log"], display_name="Pro")
m.billing.add_price("pro", 900, "eur", "month")
url = m.billing.checkout("initech", "pro", "https://app.example.com/ok", "https://app.example.com/no")["url"]

In your app, org_plan(claims), org_features(claims) and has_feature(claims, "sso") read org_plan and org_features from a token's decoded claims; no org_plan is the free tier (None, no features). They verify nothing: verify the access or ID token first.