import urllib.request import json data = json.dumps({'case_id':'custom_d888bcc4'}).encode('utf-8') req = urllib.request.Request('http://localhost:8000/api/auto-bbox', data=data, headers={'Content-Type':'application/json'}) try: with urllib.request.urlopen(req) as response: print(response.read().decode('utf-8')) except urllib.error.HTTPError as e: print(f"HTTPError: {e.code}") print(e.read().decode('utf-8'))