AsyncSandbox
- Access Linux OS
- Create, list, and delete files and directories
- Run commands
- Run isolated code
- Access the internet
AsyncSandbox.create() to create a new sandbox.
Example:
run_code
language or context option to run the code as a different language or in a different Context.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executelanguage: Language to use for code execution. If not defined, the default Python context is used.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
run_code
language or context option to run the code as a different language or in a different Context.
If no language is specified, Python is used.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executelanguage: Language to use for code execution. If not defined, the default Python context is used.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
run_code
language or context option to run the code as a different language or in a different Context.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executecontext: Concrete context to run the code in. If not specified, the default context for the language is used. It’s mutually exclusive with the language.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
create_code_context
cwd: Set the current working directory for the context, defaults to/home/userlanguage: Language of the context. If not specified, defaults to Pythonrequest_timeout: Timeout for the request in milliseconds
Sandbox
- Access Linux OS
- Create, list, and delete files and directories
- Run commands
- Run isolated code
- Access the internet
Sandbox() to create a new sandbox.
Example:
run_code
language or context option to run the code as a different language or in a different Context.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executelanguage: Language to use for code execution. If not defined, the default Python context is used.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
run_code
language or context option to run the code as a different language or in a different Context.
If no language is specified, Python is used.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executelanguage: Language to use for code execution. If not defined, the default Python context is used.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
run_code
language or context option to run the code as a different language or in a different Context.
You can reference previously defined variables, imports, and functions in the code.
Arguments:
code: Code to executecontext: Concrete context to run the code in. If not specified, the default context for the language is used. It’s mutually exclusive with the language.on_stdout: Callback for stdout messageson_stderr: Callback for stderr messageson_result: Callback for theResultobjecton_error: Callback for theExecutionErrorobjectenvs: Custom environment variablestimeout: Timeout for the code execution in secondsrequest_timeout: Timeout for the request in seconds
Execution result object
create_code_context
cwd: Set the current working directory for the context, defaults to/home/userlanguage: Language of the context. If not specified, defaults to Pythonrequest_timeout: Timeout for the request in milliseconds