Official Python SDK for Norbix — split API and Hub clients with flat module access.
Project description
norbix-python
Official Python SDK for Norbix. Use split clients with flat module access:
NorbixApifor API scope (client.database,client.membership, ...)NorbixHubfor Hub scope (client.database,client.account, ...)
Install
uv add norbix
Optional: load .env in apps with python-dotenv (load_dotenv() before constructing Norbix()).
Quickstart
from norbix_python import NorbixApi
# Service mode
norbix = NorbixApi(api_key="<api_key>", project_id="proj_123")
norbix.database.find("orders", take=20, skip=0, orderBy=[{"field": "createdAt", "direction": "desc"}])
# User mode
from norbix_python import LoginCredentials, NorbixApi
norbix = NorbixApi(project_id="proj_123")
norbix.login(LoginCredentials(user_name="alice@team.io", password="secret"))
norbix.database.find("orders", take=10)
Async client
from norbix_python import AsyncNorbix
async def main() -> None:
async with AsyncNorbix(api_key="...", project_id="proj_123") as client:
await client.api.echo.echo()
# asyncio.run(main())
Real-world examples
1) List recent orders (API scope)
from norbix_python import DatabaseFindResult, NorbixApi, NorbixError
norbix = NorbixApi(api_key="sk_live_xxx", project_id="proj_123")
try:
raw = norbix.database.find("orders", take=20, skip=0, orderBy=[{"field": "createdAt", "direction": "desc"}])
typed = DatabaseFindResult.model_validate(raw) if isinstance(raw, dict) else DatabaseFindResult()
items = typed.results
print(f"Fetched {len(items)} orders")
except NorbixError as exc:
print(exc.code, exc.status, exc.message)
2) Login as user and load profile
from norbix_python import LoginCredentials, NorbixApi
norbix = NorbixApi(project_id="proj_123")
auth = norbix.login(LoginCredentials(user_name="alice@team.io", password="secret"))
print("Logged in, token prefix:", str(auth.get("bearerToken", ""))[:16])
users = norbix.membership.get_users()
print("Users response:", users)
3) Account-scoped Hub call (requires account_id)
from norbix_python import NorbixHub
norbix = NorbixHub(
api_key="sk_live_xxx",
project_id="proj_123",
account_id="acc_456", # required for account-scoped endpoints
)
account = norbix.account.get_account_profile()
print(account)
Breaking changes (recent major-style refresh)
- Methods use snake_case (
find_one,get_database_schemas) instead of camelCase. - Path parameters are positional or keyword arguments (for example
find("orders", ...),find_one("orders", id)). Remaining query/body fields are passed as keyword args. - Use typed errors where helpful:
AuthenticationError,NotFoundError,RateLimitError,ValidationError(all subclassNorbixError).
Authentication
- API key: set
api_keyorNORBIX_API_KEY - JWT bearer: set
bearer_token,NORBIX_BEARER_TOKEN, or callnorbix.login(...) - If both are configured, bearer token wins
- If neither is configured, SDK raises
NORBIX_NOT_AUTHENTICATED
API keys and JWTs are sent as Authorization: Bearer ... (document your backend expectations).
Configuration from environment
NORBIX_API_KEY=sk_live_...
NORBIX_PROJECT_ID=proj_123
NORBIX_ACCOUNT_ID=acc_456
NORBIX_API_URL=https://api.norbix.ai
NORBIX_HUB_URL=https://hub.norbix.ai
norbix = NorbixApi() # reads from environment when values omitted
Project vs account scope
project_idis required (set explicitly or via env).account_idis optional- Account-scoped Hub methods raise
NORBIX_ACCOUNT_SCOPE_REQUIREDifaccount_idis not configured
SDK maintenance
Regenerate API and Hub modules from DTO stubs:
uv run python scripts/generate_endpoints.py
This refreshes src/norbix_python/api/, hub/, matching tests under tests/api and tests/hub, and docs under docs/.
Development
uv sync
uv run ruff check .
uv run mypy src
uv run pytest
Releases
Pushes to main, next, and beta run
python-semantic-release
and publish to PyPI.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file norbix-1.1.1.tar.gz.
File metadata
- Download URL: norbix-1.1.1.tar.gz
- Upload date:
- Size: 195.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79cc3e68d2ec1d0ad2721ef22d014f060495f01f19441c34a11721ba57cc7bfb
|
|
| MD5 |
7f843a3a1bc2e9802dd50e724b11ffc1
|
|
| BLAKE2b-256 |
922d2f9d6d26ed9a2b22be260a235f816eb4c300bcf838bc06516d10484cffa3
|
File details
Details for the file norbix-1.1.1-py3-none-any.whl.
File metadata
- Download URL: norbix-1.1.1-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
176f012ea282956fb47bacb342633ba787847adf1fac626507ff20f3228e838c
|
|
| MD5 |
f0f31045d270e5839d103a29eb2af785
|
|
| BLAKE2b-256 |
b8e7142aecb93c4165538519c1503311e6ded803871e2a705033a9c6f0fd6309
|