"""Sucht offene Abrechnungs-Tickets in TTTSol/TTTI.""" import urllib.request, json, ssl, urllib.parse secrets = {} with open("project-audit/.secrets", "r", encoding="utf-8-sig") as f: for line in f: if "=" in line and not line.startswith("#"): k, v = line.strip().split("=", 1) secrets[k.strip()] = v.strip() TOKEN = secrets.get("JIRA_TOKEN", "") ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE def search(jql): url = f"https://arija.jaas.service.deutschebahn.com/rest/api/2/search?jql={urllib.parse.quote(jql)}&maxResults=30&fields=key,summary,status,priority,assignee,updated,labels" req = urllib.request.Request(url) req.add_header("Authorization", f"Bearer {TOKEN}") resp = urllib.request.urlopen(req, context=ctx, timeout=30) return json.loads(resp.read().decode("utf-8")) def print_issues(title, jql): print(f"\n--- {title} ---") r = search(jql) total = r.get("total", 0) print(f" Total: {total}") for i in r.get("issues", [])[:20]: f = i["fields"] s = f["status"]["name"] p = (f.get("priority") or {}).get("name", "?") a = (f.get("assignee") or {}).get("displayName", "Unassigned") labels = ", ".join(f.get("labels", [])) summary = f["summary"][:70] print(f" {i['key']:<15} [{s:<14}] {p:<10} {summary}") if a != "Unassigned" or labels: extra = f"Assignee: {a}" if a != "Unassigned" else "" if labels: extra += f" Labels: {labels}" print(f" {'':15} {extra}") # Abrechnung offen print_issues( "Abrechnung (offen, TTTSol + TTTI)", 'text ~ "Abrechnung" AND (project = TTTSOL OR project = TTTI) AND statusCategory != Done ORDER BY priority DESC' ) # AC Trasse print_issues( "AC Trasse (alle Projekte, offen)", 'text ~ "AC Trasse" AND statusCategory != Done ORDER BY priority DESC' ) # O2CCIB-6931 direkt (implizite Annahme) print_issues( "O2CCIB-6931 - Implizite Annahme NAÄ", 'key = O2CCIB-6931' ) # TTTSOL-2184 direkt (implizite Annahme Highest) print_issues( "TTTSOL-2184 - Umgang mit impliziter Annahme", 'key = TTTSOL-2184' ) # TTTSOL-1677 (20h Tool) print_issues( "TTTSOL-1677 - 20h Tool", 'key = TTTSOL-1677' ) # TTTSOL-2035 (Abrechnung Zugnummer Umleitungsfall) print_issues( "TTTSOL-2035 - Abrechnung Zugnummer Umleitungsfall", 'key = TTTSOL-2035' )