import requests import json import time import urllib3 urllib3.disable_warnings() token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJob21lcGFnZTphcGlLZXkiLCJuYmYiOjE3OTQ1MDIwNzgsImlhdCI6MTc5NDUwMjA3OCwianRpIjoiZjQ2NzU0NjMtODRhOS00MjI0LWI3ODItNmY5ODQxYWEwY2UxIn0.aHhrny2RBG-vAJAyXMvan0jw65jkP3bguqEduaG78O0" headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json" } # 1. Hard refresh aerodrome-grafana url_refresh = "https://argo.snarfnet.net/api/v1/applications/aerodrome-grafana?refresh=hard" resp = requests.get(url_refresh, headers=headers, verify=False, timeout=15) print("Hard refresh status:", resp.status_code) time.sleep(3) # 2. Trigger sync url_sync = "https://argo.snarfnet.net/api/v1/applications/aerodrome-grafana/sync" sync_payload = { "revision": "HEAD", "prune": False, "strategy": {"hook": {"force": True}} } resp_sync = requests.post(url_sync, headers=headers, json=sync_payload, verify=False, timeout=15) print("Sync trigger status:", resp_sync.status_code) if resp_sync.status_code not in [200, 201]: print("Response:", resp_sync.text) time.sleep(5) # 3. Check status url_app = "https://argo.snarfnet.net/api/v1/applications/aerodrome-grafana" resp_app = requests.get(url_app, headers=headers, verify=False, timeout=10) app_data = resp_app.json() print("\n=== APPLICATION STATUS ===") print("Sync Status:", app_data.get("status", {}).get("sync", {}).get("status")) print("Health Status:", app_data.get("status", {}).get("health", {}).get("status")) print("Operation Phase:", app_data.get("status", {}).get("operationState", {}).get("phase")) print("Operation Message:", app_data.get("status", {}).get("operationState", {}).get("message"))