Skip to content

WarmHubClient

Class: warmhub.WarmHubClient

WarmHubClient(*, api_url: str | Unset = UNSET, http_client: httpx.Client | Unset = UNSET, access_token: AccessTokenProvider | Unset = UNSET, auth: AuthProvider | Unset = UNSET, function_logs: str | Unset = UNSET, client: Mapping[str, str] | ClientIdentity | Unset = UNSET, client_flags: Sequence[str] | Unset = UNSET, **unknown_options: NoReturn)

Synchronous WarmHub client.

The client owns an httpx connection pool, so it is closable:

with WarmHubClient(access_token=token) as client:
...
client = WarmHubClient(access_token=token) # also valid
client.close()

An httpx.Client passed as http_client= belongs to the caller and is never closed by the SDK.

Unlike the async client, this one accepts only synchronous token providers. An awaitable provider raises a named TypeError pointing at AsyncWarmHubClient rather than blocking a thread on someone else’s event loop.

from_env(*, api_url: str | Unset = UNSET, http_client: httpx.Client | Unset = UNSET, access_token: AccessTokenProvider | Unset = UNSET, auth: AuthProvider | Unset = UNSET, function_logs: str | Unset = UNSET, client: Mapping[str, str] | ClientIdentity | Unset = UNSET, client_flags: Sequence[str] | Unset = UNSET, **unknown_options: NoReturn)

Construct from WH_TOKEN and WARMHUB_API_URL.

Explicit keyword arguments win over the environment. The default constructor reads neither variable.

with_access_token(access_token: AccessTokenProvider)

A second client authenticating as access_token, on THIS pool.

The synchronous twin of AsyncWarmHubClient.with_access_token, including the pool-ownership contract: the derived client borrows this client’s httpx pool rather than opening a second one, so derived.owns_transport is False, derived.close() leaves the pool open, and a derived client outliving the owner it borrowed from raises the closed-client RuntimeError.

function_logs is deliberately not carried across; the clone reverts to the default mode, matching the reference.

repository(locator: str)

Bind a repository handle to locator.

Accepts the slug the UI shows and the wref a previous read returned:

sensors = client.repository("acme/sensors")
sensors = client.repository("wh:acme/sensors/Reading/probe-1")

Anything else raises ValueError naming the input and both accepted forms. Deliberately not a WarmHubError: no request was made, so a caller’s except WarmHubError around a network call must not swallow what is a typo in a literal.

close()

Close the connection pool, if this client opened it.

subscription = SyncSubscriptionNamespace(self._transport)

Documentation is not yet available.

api_url

Documentation is not yet available.

transport

Documentation is not yet available.

client_identity

Documentation is not yet available.

client_flags

Normalized client_flags, stamped on every request.

function_log_mode

Documentation is not yet available.

owns_transport

False when the caller injected an httpx.Client.

is_closed

Documentation is not yet available.

access

Documentation is not yet available.

action

Documentation is not yet available.

auth

Documentation is not yet available.

collection

Documentation is not yet available.

commit

Documentation is not yet available.

component

Documentation is not yet available.

credential

Documentation is not yet available.

diagnostics

Documentation is not yet available.

homepage

Documentation is not yet available.

org

Documentation is not yet available.

repo

Documentation is not yet available.

shape

Documentation is not yet available.

stream

Documentation is not yet available.

thing

Documentation is not yet available.

token

Documentation is not yet available.

view

Documentation is not yet available.