在沙箱中执行代码
请求头(Request Header)
请求参数(Request Parameters)
名称 | 类型 | 必须 | 位置 | 描述 |
---|---|---|---|---|
workspace_id | string | 是 | path | 工作空间 ID |
sandbox_id | string | 是 | path | 沙箱 ID |
code | string | 是 | body | 待执行代码 |
language | string | 是 | body | 编程语言,当前仅支持python |
environment | object | 否 | body | 环境变量(键值对) |
execution_timeout | integer | 否 | body | 超时时间,单位为秒,可设置范围为,默认值为60秒 |
stdin | string | 否 | body | 标准输入 |
响应(Response)
异常情况请参考异常响应说明
字段 | 类型 | 描述 |
---|---|---|
execution_id | string | 执行 ID |
result | object | 执行结果 |
其中,result
的参数如下:
字段 | 类型 | 描述 |
---|---|---|
exit_code | int32 | 退出码 |
stdout | string | 标准输出 |
stderr | string | 标准错误 |
execution_time | int64 | 执行耗时(毫秒) |
响应示例(Response Example)
- 正常响应
{
"execution_id": "string",
"result": {
"exit_code": 0,
"stdout": "string",
"stderr": "string",
"execution_time": 0
}
}