- Dockerfile/compose: Flask-App + selenium/standalone-chrome (noVNC), Healthcheck - app.py: /healthz + eingebettete noVNC-Live-Ansicht (NOVNC_URL, lokal:7900 / Cluster:/novnc/) - Helm-Chart infra/k8s/base/ibo: App + Selenium-Sidecar, 2 Ports, Ingress (/ + /novnc via stripPrefix), SSO-Middlewares aus dem CD-Repo - Gitea-CI: version -> test -> build-push -> helm-validate -> deploy-dev (Write-back) - .gitignore/.dockerignore (Dev-Samples raus) - infra/RUNBOOK-ibo.md: Zitadel/DNS/Deploy/Prod-Promote Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
cookies_setup.py - Einmal-Vorlauf ("Pre-App") zum Speichern der DSGVO-/Cookie-
|
|
Zustimmung, damit der Bot sie nicht bei jedem Lauf neu
|
|
wegklicken muss.
|
|
|
|
Was passiert:
|
|
Es oeffnet sich ein sichtbares Chrome-Fenster. Du klickst die Cookie-/DSGVO-
|
|
Zustimmung an und drueckst dann hier im Terminal ENTER. Cookies UND
|
|
localStorage der Seite werden pro Origin in consent.json gespeichert.
|
|
|
|
Der Bot (app.py / immo_bot.py) spielt diesen Snapshot beim naechsten Start
|
|
in jeden - auch parallel geoeffneten - Browser ein. Damit bleibt das
|
|
Cookie-Banner weg. Funktioniert lokal und mit dem Remote-VPS-Container.
|
|
|
|
Benutzung:
|
|
python cookies_setup.py
|
|
python cookies_setup.py "https://www.immowelt.de/"
|
|
python cookies_setup.py "https://www.immowelt.de/" "https://www.immobilienscout24.de/"
|
|
"""
|
|
|
|
import sys
|
|
|
|
import core
|
|
|
|
# Seiten, deren Consent standardmaessig einmalig bestaetigt wird.
|
|
DEFAULT_URLS = [
|
|
"https://www.immowelt.de/",
|
|
"https://www.immobilienscout24.de/",
|
|
]
|
|
|
|
|
|
def main():
|
|
urls = sys.argv[1:] or DEFAULT_URLS
|
|
|
|
print(f"Consent-Datei: {core.CONSENT_PATH}\n")
|
|
# Sichtbares, lokales Chrome (headless=False), damit du die Banner
|
|
# sehen und anklicken kannst.
|
|
driver = core.make_driver(headless=False)
|
|
|
|
try:
|
|
for url in urls:
|
|
print(f"Oeffne {url}")
|
|
driver.get(url)
|
|
input(
|
|
" -> Im Browser die Cookie-/DSGVO-Zustimmung anklicken.\n"
|
|
" Fertig? Hier ENTER druecken zum Speichern ... "
|
|
)
|
|
core.save_consent(driver)
|
|
print()
|
|
|
|
print("Fertig. Der Bot startet ab jetzt ohne erneutes Cookie-Banner.")
|
|
print("(Zum Zuruecksetzen einfach consent.json loeschen und neu starten.)")
|
|
finally:
|
|
driver.quit()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|