AsyncWarmHubClient
Class: warmhub.AsyncWarmHubClient
AsyncWarmHubClient(*, api_url: str | Unset = UNSET, http_client: httpx.AsyncClient | 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)Asynchronous WarmHub client.
The client owns an httpx connection pool, so it is closable:
async with AsyncWarmHubClient(access_token=token) as client: ...
client = AsyncWarmHubClient(access_token=token) # also validawait client.aclose()An httpx.AsyncClient passed as http_client= belongs to the caller and
is never closed by the SDK.
Methods
Section titled “Methods”from_env
Section titled “from_env”from_env(*, api_url: str | Unset = UNSET, http_client: httpx.AsyncClient | 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 — see the module docstring for why that distinction is load-bearing rather than stylistic.
with_access_token
Section titled “with_access_token”with_access_token(access_token: AccessTokenProvider)A second client authenticating as access_token, on THIS pool.
Ports withAccessToken (packages/sdk-ts/src/index.ts:6569), which
copies exactly five things onto the clone: the backend URL, the fetch
implementation, the new token, the client identity, and the client
flags — so a token-scoped clone of a CLI client keeps reporting
warmhub-cli/… rather than reverting to the SDK default, and stays
opted into whatever the parent declared. function_logs is NOT
among them, in either language: a clone reverts to the default mode.
Pool ownership. The derived client SHARES this client’s
httpx connection pool, through the same http_client= injection a
caller would use. That sharing is the point of the method — the
alternative, constructing a second client, opens a second pool. Three
consequences follow, and they are the contract:
derived.owns_transportisFalse. The pool is borrowed.await derived.aclose()does not close the pool. This client remains usable, and remains the owner.- Once THIS client closes a pool it owns, the derived client’s calls
fail the way any client on a closed injected transport fails — a
RuntimeErrornaming a closed client, per the registered deviationclient.closed_is_runtime_error. Close the derived clones first, or keep the parent alive for as long as they are.
repository
Section titled “repository”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.
aclose
Section titled “aclose”aclose()Close the connection pool, if this client opened it.
Properties and attributes
Section titled “Properties and attributes”subscription
Section titled “subscription”subscription = AsyncSubscriptionNamespace(self._transport)Documentation is not yet available.
api_url
Section titled “api_url”api_urlDocumentation is not yet available.
transport
Section titled “transport”transportDocumentation is not yet available.
client_identity
Section titled “client_identity”client_identityDocumentation is not yet available.
client_flags
Section titled “client_flags”client_flagsNormalized client_flags, stamped on every request.
function_log_mode
Section titled “function_log_mode”function_log_modeDocumentation is not yet available.
owns_transport
Section titled “owns_transport”owns_transportFalse when the caller injected an httpx.AsyncClient.
is_closed
Section titled “is_closed”is_closedDocumentation is not yet available.
access
Section titled “access”accessDocumentation is not yet available.
action
Section titled “action”actionDocumentation is not yet available.
authDocumentation is not yet available.
collection
Section titled “collection”collectionDocumentation is not yet available.
commit
Section titled “commit”commitDocumentation is not yet available.
component
Section titled “component”componentDocumentation is not yet available.
credential
Section titled “credential”credentialDocumentation is not yet available.
diagnostics
Section titled “diagnostics”diagnosticsDocumentation is not yet available.
homepage
Section titled “homepage”homepageDocumentation is not yet available.
orgDocumentation is not yet available.
repoDocumentation is not yet available.
shapeDocumentation is not yet available.
stream
Section titled “stream”streamDocumentation is not yet available.
thingDocumentation is not yet available.
tokenDocumentation is not yet available.
viewDocumentation is not yet available.