Skip to content

Leap0Client

Source: leap0/_sync/client.py

Leap0Client(*, api_key: str | None = None, base_url: str | None = None, sandbox_domain: str | None = None, timeout: float = DEFAULT_CLIENT_TIMEOUT, auth_header: str = 'authorization', bearer: bool = True, otel_enabled: bool | None = None, sdk_otel_enabled: bool | None = None)

Top-level client for the Leap0 API.

Use this client to create sandboxes and access top-level control-plane services. Sandbox-scoped services are exposed through bound sandbox objects. It can be used directly or as a context manager.

Args: api_key: API key for authentication. Falls back to LEAP0_API_KEY. base_url: Control-plane base URL. Falls back to LEAP0_BASE_URL. sandbox_domain: Sandbox domain suffix. Falls back to LEAP0_SANDBOX_DOMAIN. timeout: Default HTTP timeout in seconds. auth_header: Header name used to send the API key. bearer: Whether to prefix the API key with Bearer.

Attributes: sandboxes: Client for sandbox lifecycle operations. snapshots: Client for snapshot lifecycle operations. templates: Client for template management.

get_sandbox(sandbox_id: str) -> Sandbox

Get a sandbox object with bound service clients by ID.

Args: sandbox_id: Sandbox identifier.

Returns: Sandbox: Sandbox object with bound service clients.

create_sandbox(**kwargs: object) -> Sandbox

Create a sandbox and return it as a bound sandbox object.

Args: **kwargs: Keyword arguments forwarded to client.sandboxes.create.

Returns: Sandbox: Sandbox object with bound service clients.

close() -> None

Close the underlying HTTP transport.

Call this when you are done with the client if you are not using a context manager.