Python SDK for Code Sandbox API
Project description
Code Sandbox Python SDK
Use the Code Sandbox API to run code in 10+ languages from Python.
Install
pip install code-sandbox-sdk
Or from source in this repo:
pip install -e packages/python-sdk
Usage
from code_sandbox import Client
client = Client(api_key="your-api-key")
# Execute code
result = client.execute(language="python", code="print(2 + 2)")
print(result.stdout) # 4
print(result.success) # True
print(result.exit_code) # 0
# List runtimes
for r in client.runtimes():
print(r.language, r.version)
API
- Client(api_key, base_url=None) – Create a client.
base_urldefaults tohttp://localhost:3001. - client.execute(language, code, stdin=None, version=None) – Run code. Returns an ExecuteResult with
success,stdout,stderr,exit_code,run_time_ms,error,compile_output. - client.runtimes() – List supported languages and versions. Returns a list of Runtime objects with
language,version,aliases.
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
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 code_sandbox_sdk-1.0.0.tar.gz.
File metadata
- Download URL: code_sandbox_sdk-1.0.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ea041043c935c9ae0afa3a668ff3fe978aea17d41a3b37c5b85ca3ac13589d6
|
|
| MD5 |
ea009916100e63d21842617105826227
|
|
| BLAKE2b-256 |
2f0d40ef3bcb516545e441e0e2abc0224c25693c32b0ebb93e271f68fd44a073
|
File details
Details for the file code_sandbox_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: code_sandbox_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c41652a922dacda93c65183d12059ee282ca776c00b0ea4ba0f27c3ce6bc75d
|
|
| MD5 |
0f79eacc3d6fb9d587f3281bb49b2f30
|
|
| BLAKE2b-256 |
40aabfd92ada7fc5c53904b22a19a42532f4d32b87d200964344ac39a6cbe1be
|