aip_sdk.APIClient
aip_sdk.APIClient(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)
Synchronous HTTP client for AIP v2 API.
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.
aip_sdk.APIClient.close
aip_sdk.APIClient.close() -> None
Close the underlying HTTP connection pool.
aip_sdk.APIClient.delete
aip_sdk.APIClient.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.APIClient.get
aip_sdk.APIClient.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.APIClient.get_bytes
aip_sdk.APIClient.get_bytes(path: str, **kwargs: Any) -> bytes
Return a non-JSON GET response body as bytes.
aip_sdk.APIClient.is_closed
aip_sdk.APIClient.is_closed: bool
Whether the underlying HTTP connection pool has been closed.
aip_sdk.APIClient.iter_bytes
aip_sdk.APIClient.iter_bytes(method: str, path: str, *, 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, chunk_size: int | None = None) -> Iterator[bytes]
Stream an authenticated response body as bytes.
aip_sdk.APIClient.patch
aip_sdk.APIClient.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.APIClient.post
aip_sdk.APIClient.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.APIClient.put
aip_sdk.APIClient.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.APIClient.reopen
aip_sdk.APIClient.reopen() -> None
Re-open the HTTP connection pool if it was previously closed.
A no-op when the client is already open. Auth is recomputed per request
from self.config, so the revived client keeps the same credentials.
Lets a module-level default client survive being closed by an owning
with aip.run(...) block.
aip_sdk.APIClient.request
aip_sdk.APIClient.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 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.APIClient.config
aip_sdk.APIClient.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.APIClient.resolve_workspace
aip_sdk.APIClient.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.