Official Python SDK for Chaser
Project description
chaser-sdk
Official Python SDK for Chaser.
This package is the Python beta SDK for the core public Chaser surface:
- sessions
- workspaces
- exec
- command lifecycle
- files
- 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"))
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)
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
Release history Release notifications | RSS feed
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.1.0.tar.gz
(13.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chaser_sdk-0.1.0.tar.gz.
File metadata
- Download URL: chaser_sdk-0.1.0.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e22e41b081f6a93918c54438491f4e58de02d99c37e81733be8d7f0d805796a
|
|
| MD5 |
3a40366b21646483d841fe92de139d5c
|
|
| BLAKE2b-256 |
23fb4747b2e6c4f1aec4ba3d960f5f63b287aa73f488a4f0a8f8c2ac1debd321
|
File details
Details for the file chaser_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chaser_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a967e53a158fb9ec19e3d62ae37d474504e9f3ba71eace54a630ccd56a5b584
|
|
| MD5 |
d6b0deebf8738397bb821b67a0d0833b
|
|
| BLAKE2b-256 |
1d0786e582cf169aa640a9a58ed37f15308de5f7a6d198fe96a97fcf6dd211c8
|