Files
ankn a5f8fb49ab Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
      Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
      Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)

Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
2026-06-30 20:39:52 +02:00

46 lines
1.5 KiB
Python

"""Liest TrassenOrder User Research von SAB Confluence."""
import urllib.request, json, ssl, re
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()
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
CONF_TOKEN = secrets.get("CONFLUENCE_SAB", "")
CONF_URL = "https://systelone-confluence.jaas.service.deutschebahn.com/rest/api"
PAGE_ID = "85858484"
print(f"Token: ...{CONF_TOKEN[-4:]}")
print(f"URL: {CONF_URL}/content/{PAGE_ID}")
print()
try:
req = urllib.request.Request(f"{CONF_URL}/content/{PAGE_ID}?expand=body.storage")
req.add_header("Authorization", f"Bearer {CONF_TOKEN}")
resp = urllib.request.urlopen(req, context=ctx, timeout=30)
data = json.loads(resp.read().decode("utf-8"))
title = data.get("title", "?")
body = data["body"]["storage"]["value"]
print(f"Titel: {title}")
# HTML zu Text
text = re.sub(r'<[^>]+>', '\n', body)
text = re.sub(r'\n{3,}', '\n\n', text).strip()
print(f"Laenge: {len(text)} Zeichen")
print()
print(text[:5000])
# Speichern
with open("project-audit/data/trapo-user-research.txt", "w", encoding="utf-8") as f:
f.write(text)
print(f"\n\nGespeichert: project-audit/data/trapo-user-research.txt ({len(text)} Zeichen)")
except Exception as e:
print(f"Fehler: {e}")