diff --git a/backend/routes/admin_routes.py b/backend/routes/admin_routes.py index 7db6f97..d34f68a 100644 --- a/backend/routes/admin_routes.py +++ b/backend/routes/admin_routes.py @@ -20,7 +20,12 @@ def trigger_crawl(): } """ try: - data = request.get_json() or {} + # Handle both JSON and empty body + try: + data = request.get_json(silent=True) or {} + except: + data = {} + max_articles = data.get('max_articles', 10) # Validate max_articles @@ -154,7 +159,12 @@ def send_newsletter(): } """ try: - data = request.get_json() or {} + # Handle both JSON and empty body + try: + data = request.get_json(silent=True) or {} + except: + data = {} + max_articles = data.get('max_articles', 10) # Validate max_articles