MCPcopy Create free account
hub / github.com/PostHog/duckgres / ReportClient

Class ReportClient

scripts/client-compat/report_client.py:21–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20
21class ReportClient:
22 def __init__(self, client_name: str):
23 self.client = client_name
24 self.url = os.environ.get("RESULTS_URL", "http://results-gatherer:8080")
25
26 def _post(self, path: str, data: dict):
27 try:
28 req = urllib.request.Request(
29 f"{self.url}{path}",
30 data=json.dumps(data).encode(),
31 headers={"Content-Type": "application/json"},
32 method="POST",
33 )
34 urllib.request.urlopen(req, timeout=2)
35 except Exception:
36 pass
37
38 def report(self, suite: str, test_name: str, status: str, detail: str = ""):
39 self._post("/result", {
40 "client": self.client,
41 "suite": suite,
42 "test_name": test_name,
43 "status": status,
44 "detail": detail,
45 })
46
47 def done(self):
48 self._post("/done", {"client": self.client})

Callers 5

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls

no outgoing calls

Tested by 5

mainFunction · 0.72
mainFunction · 0.72
mainFunction · 0.72
mainFunction · 0.72
mainFunction · 0.72