Skip to content

Commit

Permalink
Ignore bot requests
Browse files Browse the repository at this point in the history
  • Loading branch information
smathot committed Apr 4, 2024
1 parent c17da2e commit 3549e70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion heymans/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3549e70

Please sign in to comment.