Skip to main content

Installation & Configuration

Installation

Install from PyPI:

pip install qarion-sdk

For local development of the SDK itself:

pip install -e ".[dev]"

Configuration

Configuration is handled through the QarionConfig dataclass. You can pass values directly to the client constructor or set environment variables.

ParameterEnvironment VariableDefaultDescription
api_keyQARION_API_KEYrequiredYour API key (starts with qk_)
base_urlQARION_BASE_URLhttp://localhost:8000Platform API base URL
timeout30.0 secondsRequest timeout
max_retries3Automatic retry count for transient failures

Using Environment Variables

The simplest approach — set your credentials once and every client picks them up automatically:

export QARION_API_KEY="qk_your_api_key_here"
export QARION_BASE_URL="https://api.qarion.com"
from qarion import QarionClient

# No arguments needed — reads from environment
async with QarionClient() as client:
spaces = await client.spaces.list()

Explicit Configuration

Pass parameters directly when you need per-client control:

from qarion import QarionClient

async with QarionClient(
api_key="qk_...",
base_url="https://api.qarion.com",
timeout=60.0,
max_retries=5,
) as client:
spaces = await client.spaces.list()

Client Lifecycle

Both clients implement the context-manager protocol. Always use with / async with to ensure the underlying HTTP connection is closed properly:

# Async
async with QarionClient(api_key="qk_...") as client:
... # connection is open here
# connection closed automatically

# Sync
with QarionSyncClient(api_key="qk_...") as client:
... # connection is open here
# connection closed automatically

If you prefer manual control, call close() explicitly:

client = QarionSyncClient(api_key="qk_...")
try:
spaces = client.spaces.list()
finally:
client.close()

Requirements

  • Python ≥ 3.10
  • httpx — async and sync HTTP transport
  • pydantic — typed response models