MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / _get_upstream_json

Function _get_upstream_json

dashboard/hermes-wrapper/plugin_api.py:701–723  ·  view source on GitHub ↗

GET an upstream tracedecay path and return the parsed JSON object.

(path: str)

Source from the content-addressed store, hash-verified

699
700
701def _get_upstream_json(path: str) -> dict:
702 """GET an upstream tracedecay path and return the parsed JSON object."""
703 base = _upstream_base()
704 url = f"{base}{path}"
705 req = urllib.request.Request(url, method="GET")
706 try:
707 with urllib.request.urlopen(req, timeout=_PROXY_TIMEOUT_SECONDS) as resp: # noqa: S310 — loopback/configured upstream only
708 payload = json.loads(resp.read().decode("utf-8"))
709 except urllib.error.HTTPError as exc:
710 raise HTTPException(
711 status_code=502,
712 detail=f"tracedecay dashboard returned {exc.code} for {path}",
713 ) from exc
714 except Exception as exc:
715 raise HTTPException(
716 status_code=502,
717 detail=f"tracedecay dashboard unreachable: {exc}",
718 ) from exc
719 if not isinstance(payload, dict):
720 raise HTTPException(
721 status_code=502, detail=f"unexpected upstream payload for {path}"
722 )
723 return payload
724
725
726def _post_upstream_json(path: str, payload: dict) -> tuple[int, Any]:

Callers 1

_curation_llm_planFunction · 0.85

Calls 2

_upstream_baseFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected