summaryrefslogtreecommitdiff
path: root/searx/botdetection/http_user_agent.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2023-05-26 17:24:43 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2023-06-01 14:38:53 +0200
commit66fdec0eb92bf11c0bc477d6fb1df3dc783e4dcb (patch)
tree2ce8a9ecf1cdae68e4745c24cab01482d07a5447 /searx/botdetection/http_user_agent.py
parent1ec325adccc427fe05cf08da9a2d9d63da7365f4 (diff)
downloadsearxng-66fdec0eb92bf11c0bc477d6fb1df3dc783e4dcb.tar.gz
searxng-66fdec0eb92bf11c0bc477d6fb1df3dc783e4dcb.zip
[mod] limiter: add config file /etc/searxng/limiter.toml
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/botdetection/http_user_agent.py')
-rw-r--r--searx/botdetection/http_user_agent.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/searx/botdetection/http_user_agent.py b/searx/botdetection/http_user_agent.py
index 892ae0bd9..3d1ec9173 100644
--- a/searx/botdetection/http_user_agent.py
+++ b/searx/botdetection/http_user_agent.py
@@ -12,11 +12,15 @@ the User-Agent_ header is unset or matches the regular expression
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
"""
+# pylint: disable=unused-argument
from typing import Optional, Tuple
import re
import flask
+from searx.tools import config
+
+
USER_AGENT = (
r'('
+ r'unknown'
@@ -44,7 +48,7 @@ def regexp_user_agent():
return _regexp
-def filter_request(request: flask.Request) -> Optional[Tuple[int, str]]:
+def filter_request(request: flask.Request, cfg: config.Config) -> Optional[Tuple[int, str]]:
user_agent = request.headers.get('User-Agent', 'unknown')
if regexp_user_agent().match(user_agent):
return (