"""Call the local API using only Python's standard library.""" import json import urllib.request from pathlib import Path body = (Path(__file__).parent/'request.json').read_bytes() request = urllib.request.Request( 'http://127.0.0.1:8000/v1/judgments', data=body, headers={'Content-Type': 'application/json'}, method='POST', ) with urllib.request.urlopen(request, timeout=180) as response: print(json.dumps(json.load(response), indent=2, ensure_ascii=False))