Files
buryan-infra/ops/bots/hub/gateway.py
T
architect 8844dabf94
lint / hygiene (pull_request) Failing after 25s
standard / check (pull_request) Successful in 11s
lint / hygiene (push) Failing after 33s
standard / check (push) Successful in 12s
[STAGE5] Migrate PhotoBot to Tool Gateway with local tools
2026-11-29 22:05:34 +03:00

18 lines
441 B
Python

"""Tiny client for the Buryans Tool Gateway."""
import json
import urllib.request
BASE = "http://127.0.0.1:9137"
def call(tool):
with urllib.request.urlopen(BASE + "/v1/call?tool=" + tool, timeout=25) as r:
d = json.loads(r.read().decode())
body = d.get("body")
if isinstance(body, str):
try:
return json.loads(body)
except Exception:
return {"raw": body}
return body or {}