import json, os, time, urllib.request, urllib.error OM = "http://openmetadata-server:8585/api" H = {"Authorization": "Bearer " + os.environ["OM_TOKEN"]} def req(method, path, body=None): data = json.dumps(body).encode() if body is not None else None h = dict(H) if data is not None: h["Content-Type"] = "application/json" r = urllib.request.Request(OM + path, data=data, headers=h, method=method) try: with urllib.request.urlopen(r, timeout=60) as resp: return resp.status, (json.loads(resp.read().decode() or "{}")) except urllib.error.HTTPError as e: return e.code, e.read().decode()[:250] for app in ["SearchIndexingApplication", "DataInsightsApplication"]: st, r = req("POST", "/v1/apps/trigger/" + app, {}) print("trigger %-30s -> %s %s" % (app, st, str(r)[:120]))