import requests import json import urllib3 urllib3.disable_warnings() token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJob21lcGFnZTphcGlLZXkiLCJuYmYiOjE3OTQ1MDIwNzgsImlhdCI6MTc5NDUwMjA3OCwianRpIjoiZjQ2NzU0NjMtODRhOS00MjI0LWI3ODItNmY5ODQxYWEwY2UxIn0.aHhrny2RBG-vAJAyXMvan0jw65jkP3bguqEduaG78O0" headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json" } resp = requests.get("https://argo.snarfnet.net/api/v1/applications", headers=headers, verify=False, timeout=10) data = resp.json() items = data.get("items", []) for app in items: name = app.get("metadata", {}).get("name") sync = app.get("status", {}).get("sync", {}).get("status") health = app.get("status", {}).get("health", {}).get("status") resources = app.get("status", {}).get("resources", []) out_resources = [r for r in resources if r.get("status") != "Synced" or r.get("health", {}).get("status") not in ["Healthy", None]] print(f"[{name}] Sync: {sync}, Health: {health}, Total Resources: {len(resources)}") if out_resources: print(f" -> Out-of-sync / unhealthy resources:") for r in out_resources: print(f" {r.get('kind')}/{r.get('name')}: Sync={r.get('status')}, Health={r.get('health', {}).get('status')}")