This repository has been archived on 2026-08-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ROCm-Research-Archive/_TestScripts/Scripts and Tests/test_webhook.py
T
2026-08-20 00:45:43 +02:00

20 lines
732 B
Python

#!/usr/bin/env python3
import urllib.request as u, json
req = u.Request("http://localhost:9090/api/proxy/image",
data=json.dumps({"prompt":"a cat on a boat","width":512,"height":512,"steps":4,"cfg_scale":1.0,"sampler":"euler","scheduler":"smoothstep"}).encode(),
headers={"Content-Type":"application/json"})
try:
r = u.urlopen(req, timeout=300)
body = r.read()
print("STATUS:", r.status)
print("LEN:", len(body))
d = json.loads(body)
if d.get("data"):
print("IMAGE_B64_LEN:", len(d["data"][0].get("b64_json","")))
else:
print("NO DATA:", body[:300])
except Exception as e:
print("ERROR:", type(e).__name__, e)
if hasattr(e, 'read'):
print("BODY:", e.read()[:500])