This page is about the Python interpreter environment inside the Riza Code Interpreter API. If you’re looking to call the API from Python, see the API Client Libraries guide.

Runtime

Riza runs Python 3.12.0 compiled to WASM. The entire standard library is included.

Limitations

There are no limitations beyond the general sandbox limitations that apply to all Riza interpreter runtime environments.

See our roadmap for planned future improvements.

Output

You can write to stdout and stderr as you typically would.

import sys

print('Hello, World!')
print('Something bad happened', file=sys.stderr)

Input

You can read from stdin and access command line arguments and environment variables, all as you typically would.

import os, sys

print(sys.stdin.read())
print(sys.argv)
print(dict(os.environ))

HTTP

You can make HTTP requests using the requests or httpx packages.

import requests

resp = requests.post("https://httpbin.org/post", json={
    "foo": "bar",
})
print(resp.json())
import httpx

resp = httpx.post("https://httpbin.org/post", json={
    "foo": "bar",
})
print(resp.json())

Network access is blocked by default, so you need to allow HTTP traffic to individual hosts using the allow_http_hosts parameter. See the HTTP guide for a full example.