Python SDK Quickstart
Set a personal access token, install the package, and run a small synchronous program:
export WH_TOKEN="wh_..."pip install warmhubfrom warmhub import WarmHubClient
with WarmHubClient.from_env() as client: repo = client.repository("acme/sensors")
page = repo.things.head(shape="Reading", limit=5) for item in page.items: print(item.wref, item.version, item.data)
batch = repo.batch(message="seed a reading") batch.add( name="Reading/probe-1", data={"temp_celsius": 21.4}, ) result = batch.commit() print(result.operation_count)The read uses the repository-bound
repository.things
surface. batch.add(...) only constructs an operation; batch.commit() is the
line that sends it.
Async form
Section titled “Async form”The async client exposes the same repository paths and arguments:
from warmhub import AsyncWarmHubClient
async with AsyncWarmHubClient.from_env() as client: repo = client.repository("acme/sensors") page = await repo.things.head(shape="Reading", limit=5)
batch = repo.batch(message="seed a reading") batch.add(name="Reading/probe-2", data={"temp_celsius": 19.8}) result = await batch.commit()See the repository client reference for bound writes and validation, or the client namespace index when a call needs to address different repositories dynamically.