import Riza from '@riza-io/api';

const pythonCode = `
import sys
print("Writing to stdout")
print("Writing to stderr", file=sys.stderr)
`;

const riza = new Riza();

async function main() {
  const resp = await riza.command.exec({
    language: "python",
    code: pythonCode,
  });
  console.log(resp);
}

main();
{
    "exit_code": 0,
    "stdout": "Writing to stdout",
    "stderr": "Writing to stderr",
}

Your script has access to stdout and stderr for writing output. The API also returns the program’s exit code.

Write to stdout

The execute code endpoint returns anything your script writes to stdout as the value of the stdout parameter.

Write to stderr

The execute code endpoint returns anything your script writes to stderr as the value of the stderr parameter.

import Riza from '@riza-io/api';

const pythonCode = `
import sys
print("Writing to stdout")
print("Writing to stderr", file=sys.stderr)
`;

const riza = new Riza();

async function main() {
  const resp = await riza.command.exec({
    language: "python",
    code: pythonCode,
  });
  console.log(resp);
}

main();
{
    "exit_code": 0,
    "stdout": "Writing to stdout",
    "stderr": "Writing to stderr",
}