From 3549e7056d0380b19955c6da4d0b1cdffe8134af Mon Sep 17 00:00:00 2001 From: smathot Date: Thu, 4 Apr 2024 18:47:52 +0200 Subject: [PATCH] Ignore bot requests --- heymans/server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/heymans/server.py b/heymans/server.py index 6c9f797..25bce02 100644 --- a/heymans/server.py +++ b/heymans/server.py @@ -36,7 +36,9 @@ def load_user(user_id): @app.after_request def log_request(response): - logger.info(f'request from {request.remote_addr}: {request.full_path}') + user_agent = request.headers.get('User-Agent') + if 'bot' not in user_agent.lower(): + logger.info(f'request: {request.full_path}') return response return app