Skip to content
sandboxapiPublic

About

Runnable Python, JavaScript, and curl examples for SandboxAPI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SandboxAPI examples

Runnable examples for executing code in SandboxAPI's isolated sandboxes.

Get an API key

Subscribe to SandboxAPI on RapidAPI and copy your key. Set it in the terminal where you run these examples:

export RAPIDAPI_KEY='YOUR_RAPIDAPI_KEY'

Keep your real key out of source files and Git commits. Requests use the RapidAPI endpoint at https://sandboxapi.p.rapidapi.com.

Python

Requires Python 3; uses only the standard library.

python3 execute.py

The example executes print(2 + 2) and prints 4.

JavaScript

Requires Node.js 18 or newer; no npm dependencies.

node execute.mjs

The example executes console.log(2 + 2) and prints 4.

curl

curl --fail-with-body --show-error --silent \
  https://sandboxapi.p.rapidapi.com/v1/execute \
  -H "Content-Type: application/json" \
  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: sandboxapi.p.rapidapi.com" \
  -d '{"language":"python3","code":"print(2 + 2)"}'

Inspect the response's status, stdout, stderr, and exit_code: a successful HTTP response can still report an error in the submitted code.

More examples and documentation

These examples call your subscribed RapidAPI endpoint and count toward your plan's request allowance. The examples are licensed under MIT.

About

Runnable Python, JavaScript, and curl examples for SandboxAPI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages