aip_sdk.AsyncAPIClient
aip_sdk.AsyncAPIClient(base_url: str | None = None, api_key: str | None = None, impersonate_user_id: str | None = None, token: str | None = None, workspace_id: str | None = None, *, user_id: str | None = None, _auto_login: bool = True)
Asynchronous HTTP client for AIP v2 API.
Drop-in async counterpart to APIClient. Uses httpx.AsyncClient
internally; all public methods are coroutines and must be awaited.
Auth precedence: JWT Bearer token > x-api-key > unauthenticated.
impersonate_user_id is not a credential — it is an admin-only override
layered on top of whichever credential authenticates the call.
Parameters
base_urlstr | None: Base URL of theaip-apiservice.api_keystr | None: Long-lived API key, sent asx-api-key.impersonate_user_idstr | None: Admin-only override scoping calls to another user's data, sent asx-user-id. Ignored for non-admin credentials.tokenstr | None: Pre-obtained JWT. Short-lived, and never refreshed by this client.workspace_idstr | None: Default workspace for calls that take one.user_idstr | None: Deprecated alias forimpersonate_user_id.
Example:
async with AsyncAPIClient(base_url=..., api_key=...) as client:
data = await client.get("/suts")
aip_sdk.AsyncAPIClient.close
async aip_sdk.AsyncAPIClient.close() -> None
Close the underlying async HTTP connection pool and any cached sync client.
aip_sdk.AsyncAPIClient.delete
async aip_sdk.AsyncAPIClient.delete(path: str, *, scope: WorkspaceScope | None = None, workspace: WorkspaceRequest | ResolvedWorkspace | None = None, **kwargs: Any) -> Any
DELETE via request(); see it for scope/workspace and the other kwargs.
aip_sdk.AsyncAPIClient.get
async aip_sdk.AsyncAPIClient.get(path: str, *, scope: WorkspaceScope | None = None, workspace: WorkspaceRequest | ResolvedWorkspace | None = None, **kwargs: Any) -> Any
GET via request(); see it for scope/workspace and the other kwargs.
aip_sdk.AsyncAPIClient.is_closed
aip_sdk.AsyncAPIClient.is_closed: bool
Whether the underlying async HTTP connection pool has been closed.
aip_sdk.AsyncAPIClient.patch
async aip_sdk.AsyncAPIClient.patch(path: str, *, scope: WorkspaceScope | None = None, workspace: WorkspaceRequest | ResolvedWorkspace | None = None, **kwargs: Any) -> Any
PATCH via request(); see it for scope/workspace and the other kwargs.
aip_sdk.AsyncAPIClient.post
async aip_sdk.AsyncAPIClient.post(path: str, *, scope: WorkspaceScope | None = None, workspace: WorkspaceRequest | ResolvedWorkspace | None = None, **kwargs: Any) -> Any
POST via request(); see it for scope/workspace and the other kwargs.
aip_sdk.AsyncAPIClient.put
async aip_sdk.AsyncAPIClient.put(path: str, *, scope: WorkspaceScope | None = None, workspace: WorkspaceRequest | ResolvedWorkspace | None = None, **kwargs: Any) -> Any
PUT via request(); see it for scope/workspace and the other kwargs.
aip_sdk.AsyncAPIClient.reopen
aip_sdk.AsyncAPIClient.reopen() -> None
Re-open the async HTTP connection pool if it was previously closed.
A no-op when already open. Mirrors APIClient.reopen() so a
module-level default async client survives an owning ``async with
aip.arun(...)`` block closing it. Also drops any cached sync client
(closed alongside this one in close()) so it is lazily rebuilt
fresh on the next _sync_from_async call instead of staying closed.
aip_sdk.AsyncAPIClient.request
async aip_sdk.AsyncAPIClient.request(method: str, path: str, *, scope: WorkspaceScope | None = None, workspace: WorkspaceRequest | ResolvedWorkspace | None = None, json: dict[str, Any] | None = None, params: dict[str, Any] | None = None, files: dict[str, Any] | None = None, data: dict[str, Any] | None = None, headers: dict[str, str] | None = None) -> Any
Make an authenticated async request with automatic retry on transient failures.
Parameters
methodstr: The HTTP method, e.g."GET".pathstr: The request path, relative to the client's configuredbase_url.scopeWorkspaceScope | None: Which workspace-resolution mode this call declares, without saying where the resolved value goes — seeWorkspaceScope. Resolved into a query parameter. Omitting it warns and resolves nothing; it will become required in a future release.get/post/patch/put/deletedefault it toWorkspaceScope.NONE; that default goes away with this deprecation.workspaceWorkspaceRequest | ResolvedWorkspace | None: The full declaration — how to resolve the workspace and where to send it (seeWorkspaceRequest). Pass this orscope, not both. Pass aResolvedWorkspaceto place an already-resolved value.jsondict[str, Any] | None: JSON request body.paramsdict[str, Any] | None: Query string parameters.filesdict[str, Any] | None: Multipart file uploads.datadict[str, Any] | None: Form-encoded request body.headersdict[str, str] | None: Extra headers, merged over the client's own auth headers.
Returns
Any: The parsed JSON response body, orNonefor a 204 or empty body.
Raises
APIError: Or one of its typed subclasses, mapped from the response status.InvalidArgumentError: The workspace declaration combines arguments that cannot be honoured together.NoWorkspaceSelectedError: The call needed a workspace and none resolved.
Inherited members
Inherited from libs/aip-sdk/src/aip_sdk/client.py
aip_sdk.AsyncAPIClient.config
aip_sdk.AsyncAPIClient.config = get_config(base_url=base_url, api_key=api_key, impersonate_user_id=impersonate_user_id, token=token, workspace_id=workspace_id)
No docstring is defined in the source.
Inherited from libs/aip-sdk/src/aip_sdk/client.py
aip_sdk.AsyncAPIClient.resolve_workspace
aip_sdk.AsyncAPIClient.resolve_workspace(spec: WorkspaceRequest) -> ResolvedWorkspace
Resolve a workspace declaration now, before the request is made.
For a call that needs the resolved workspace in its own code — to name it in an
error message, build a path from it, choose between two routes, or filter a
response. Pass the result straight back as request(workspace=...): it is
already resolved, so nothing resolves twice and the value sent cannot drift from
the value used.
Parameters
specWorkspaceRequest: The declaration to resolve.
Returns
ResolvedWorkspace: The resolved workspace and its placement.
Raises
InvalidArgumentError: The declaration combines arguments that cannot be honoured together, e.g.workspace_idwithproject_id.NoWorkspaceSelectedError: The call needed a workspace and none resolved.