Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuickTane Python SDK

Run code in isolated, ephemeral cloud sandboxes (QuickTane) — one API call.

pip install quicktane

Quickstart

from quicktane import QuickTane

qt = QuickTane("sk_live_...")           # or set QUICKTANE_API_KEY

run = qt.run_and_wait("print('hello from the sandbox')", language="python")

print(run.status)      # "completed"
print(run.output)      # "hello from the sandbox\n"
print(run.exit_code)   # 0

Supported languages: python, node.

Fire-and-forget + webhooks

Instead of waiting, queue the run and let a webhook notify you when it finishes:

run = qt.run("print(2 + 2)", language="python")
print(run.run_id, run.status)   # 42 running

# later, or fetch on demand:
run = qt.get_run(42)

Register a webhook endpoint in your dashboard, then verify deliveries:

from quicktane import verify_signature

# in your webhook handler — use the RAW request body
if not verify_signature(raw_body, request.headers["X-QuickTane-Signature"], signing_secret):
    abort(400)

Interactive sessions

Run many commands in one live sandbox — file and process state persist between calls:

sbx = qt.create_sandbox("python")            # waits until ready

sbx.files.write("app.py", "print('hello from a session')")
result = sbx.exec(command="python app.py")
print(result.stdout, result.ok)              # "hello from a session\n" True

# state persists across execs:
sbx.exec(command="pip install requests")
sbx.exec("import requests; print(requests.__version__)")

sbx.kill()

# or auto-kill with a context manager:
with qt.create_sandbox("node") as sbx:
    print(sbx.exec("console.log(2 + 2)").stdout)

Configuration

QuickTane(api_key, base_url=..., timeout=...) client; api_key falls back to QUICKTANE_API_KEY
QUICKTANE_BASE_URL override the API base (e.g. http://localhost:8000 for local dev)

Errors

All errors subclass quicktane.QuickTaneError:

AuthenticationError (401/403), NotFoundError (404), ValidationError (422), RateLimitError (429), APIError (other). Each carries .status_code and .body.

Development

pip install -e '.[dev]'
pytest

MIT licensed.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages