from openapi import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.sandbox.run_command(session_id_param="demo-python-20260316", session_id="demo-python-20260316", command="python3", session_token="sandbox_test_20260316_4f9c2b1a", args=[
"-c",
"import math; print(math.sqrt(144))",
], cwd=None, env={
}, timeout_seconds=60)
# Handle response
print(res){
"session_id": "demo-python-20260316",
"command": "python3",
"args": [
"-c",
"import math; print(math.sqrt(144))"
],
"cwd": "/workspace",
"stdout": "12.0\n",
"stderr": "",
"exit_code": 0,
"files_changed": []
}Ejecuta un comando en el espacio de trabajo de la sesión y devuelve stdout, stderr, código de salida y archivos modificados.
from openapi import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.sandbox.run_command(session_id_param="demo-python-20260316", session_id="demo-python-20260316", command="python3", session_token="sandbox_test_20260316_4f9c2b1a", args=[
"-c",
"import math; print(math.sqrt(144))",
], cwd=None, env={
}, timeout_seconds=60)
# Handle response
print(res){
"session_id": "demo-python-20260316",
"command": "python3",
"args": [
"-c",
"import math; print(math.sqrt(144))"
],
"cwd": "/workspace",
"stdout": "12.0\n",
"stderr": "",
"exit_code": 0,
"files_changed": []
}Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.
¿Esta página le ayudó?