"""Snapshot the OPEN tracker state for the road handoff doc.""" import base64 import json import subprocess import urllib.request REPO = r"C:\git\bt411" API = "https://gitea.mysticmachines.com/api/v1/repos/VWE/BT411/issues" out = subprocess.run(["git", "credential", "fill"], input="protocol=https\nhost=gitea.mysticmachines.com\n\n", capture_output=True, text=True, cwd=REPO) cred = dict(l.split("=", 1) for l in out.stdout.strip().splitlines() if "=" in l) AUTH = "Basic " + base64.b64encode( (cred["username"] + ":" + cred["password"]).encode()).decode() def api(path): req = urllib.request.Request(API + path) req.add_header("Authorization", AUTH) return json.load(urllib.request.urlopen(req)) rows = [] page = 1 while True: batch = api("?state=open&limit=50&page=%d" % page) if not batch: break rows.extend(batch) page += 1 awaiting, live = [], [] for i in rows: labels = [l["name"] for l in i.get("labels", [])] rec = (i["number"], i["title"][:78], ",".join(labels)) (awaiting if "awaiting-verification" in labels else live).append(rec) print("OPEN TOTAL: %d awaiting-verification: %d genuinely open: %d" % (len(rows), len(awaiting), len(live))) print() print("=== GENUINELY OPEN (real work) ===") for n, t, l in sorted(live): print(" #%-3d %-78s [%s]" % (n, t, l)) print() print("=== AWAITING LIVE VERIFICATION (fix landed) ===") for n, t, l in sorted(awaiting): print(" #%-3d %s" % (n, t))