jevfieldnotes
INTEGRATIONS

Call Jev from Python with the standard library

Read request.json, send it with urllib and print the response.

2 MIN READ · UPDATED 20 SEP 2026

Prepare the two inputs

Download request.json from Request Builder and set TYPESAFE_API_KEY in your terminal. Save the script below as request.py in the same folder. No third-party package is needed.

Run the script

Run python request.py. A successful call prints the response JSON. Find your question identifier under answers. If the default builder question is decision, inspect answers.decision rather than looking for a top-level category.

When it fails

FileNotFoundError means Python cannot find request.json in the current folder. A missing TYPESAFE_API_KEY raises KeyError. For an HTTPError, inspect the status and error body without printing credentials. The authentication and timeout guides cover those cases.

When you need more than one request

This example only sends and prints. The downloadable labs add answer validation, retries and per-row results. The official Python SDK is another option; use its own setup instructions rather than mixing SDK types with this urllib example.

Code example

import json, os, urllib.request
payload = json.load(open("request.json"))
request = urllib.request.Request(
    "https://api.typesafe.ai/v1/systemone",
    data=json.dumps(payload).encode(),
    headers={"Authorization": "Bearer " + os.environ["TYPESAFE_API_KEY"],
             "Content-Type": "application/json"})
with urllib.request.urlopen(request, timeout=30) as response:
    print(response.read().decode())