feat: Webhooks (Aufgaben 6-10) — webhook.py, worker.py, Flask-App, WhatsApp + Telegram Routes + Tests

This commit is contained in:
hermes
2026-06-22 07:58:25 +00:00
parent 6f7c5eada2
commit 56b02c1c2d
11 changed files with 629 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
"""Flask App-Factory Einstiegspunkt des BSN-Livesystems."""
from flask import Flask, jsonify
from src.queue.handler import QueueHandler
def create_app() -> Flask:
"""Erstellt und konfiguriert die Flask-App.
Nutzt das App-Factory-Pattern für saubere Initialisierung.
Der QueueHandler wird als App-Extension hinterlegt.
Returns:
Die konfigurierte Flask-App-Instanz.
"""
app = Flask(__name__)
app.config.from_mapping(
REDIS_HOST="localhost",
REDIS_PORT=6379,
)
app.queue_handler = QueueHandler(
redis_host=app.config["REDIS_HOST"],
redis_port=app.config["REDIS_PORT"],
)
@app.route("/health")
def health() -> dict:
"""Health-Check Endpoint für Monitoring."""
return {"status": "ok", "queue_size": app.queue_handler.queue_size()}
return app