Skip to main content

Official Python SDK for Chaser

Project description

chaser-sdk

Official Python SDK for Chaser.

This package is the Python SDK for the core public Chaser surface:

  • sessions
  • workspaces
  • exec
  • command lifecycle
  • files
  • runtime self-tests and preview URLs
  • browser CDP helpers
  • accounts and organizations
  • service accounts and keys
  • billing
  • lifecycle webhooks
  • audit
  • jobs

Installation

pip install chaser-sdk

Optional CDP websocket support:

pip install 'chaser-sdk[cdp]'

Quickstart

from chaser_sdk import ChaserClient

client = ChaserClient(api_key="sk_...", account="personal")

workspace = client.workspaces.create(
    name="frontend-app",
    session_type="sandbox",
    image="ghcr.io/example/dev:latest",
)

session = client.sessions.create(
    workspace=workspace["name"],
    session_type="sandbox",
)

client.sessions.wait_until_ready(session["id"])
result = client.exec.in_session(
    session["id"],
    command="node -v && pwd",
    cwd="/workspace",
)

print(result.get("output"))

All write helpers accept keyword arguments, and the legacy payload-dict form still works for backward compatibility.

Proxy selection

session = client.sessions.create(
    session_type="sandbox",
    ephemeral=True,
    proxy="socks5h://user:pass@proxy.example.com:1080",
)

Use the root-level proxy field for the public API contract.

Stateless exec

result = client.exec.run(
    ephemeral=True,
    image="node:20-bookworm",
    command="python3 -c 'print(42)'",
)

Files and previews

client.files.upload_text(session["id"], "/workspace/hello.txt", "hello from sdk")
text = client.files.download_text(session["id"], "/workspace/hello.txt")
preview = client.sessions.forward_url(session["id"], 3000)

Runtime self-test

diagnostics = client.sessions.self_test(session["id"])
print(diagnostics["runtime"]["tools"].get("node"))

Browser CDP helper

browser = client.sessions.create(session_type="browser", ephemeral=True)
ws_url = client.browser.cdp_websocket_url(browser["id"])
print(ws_url)

If you install the optional cdp extra, you can also open a lightweight websocket client:

cdp = client.browser.connect(browser["id"])
print(cdp.send("Browser.getVersion"))
cdp.close()

Organization automation

org_client = client.with_account("Acme Engineering")
service_account = org_client.accounts.service_accounts.create("ci-bot")
key = org_client.accounts.service_accounts.keys.create(
    service_account["id"],
    name="ci-key",
    scopes=["sessions.read", "workspaces.write", "exec.write", "files.read", "webhooks.write"],
)
print(key["key"])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chaser_sdk-0.2.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chaser_sdk-0.2.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file chaser_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: chaser_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for chaser_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ec9eff4b3550bd219b3789b86a04611a2d7842e46a7483a41bfa9d6f864c5dbc
MD5 b6894f64e579e8df5b6262197cad56c7
BLAKE2b-256 a8fcfdc2224f888644d472e178036f02804135f323673dd9890f165fbf912dac

See more details on using hashes here.

File details

Details for the file chaser_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: chaser_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for chaser_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c6151d7a08a8f2562798934f4c314c7ffb0168f0f529cc362cde23cca783c5da
MD5 ca32c8e6fb6819ff75b211f28a24e671
BLAKE2b-256 4574fb231329980f6c1ea1e33d09672db8db849118849f9a23e43f955ac1d1eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page