diff options
Diffstat (limited to 'searx/botdetection/http_accept.py')
| -rw-r--r-- | searx/botdetection/http_accept.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/searx/botdetection/http_accept.py b/searx/botdetection/http_accept.py index 23670a283..60e2330ae 100644 --- a/searx/botdetection/http_accept.py +++ b/searx/botdetection/http_accept.py @@ -15,13 +15,15 @@ Accept_ header .. """ # pylint: disable=unused-argument -from typing import Optional, Tuple +from typing import Optional import flask +import werkzeug from searx.tools import config +from ._helpers import too_many_requests -def filter_request(request: flask.Request, cfg: config.Config) -> Optional[Tuple[int, str]]: +def filter_request(request: flask.Request, cfg: config.Config) -> Optional[werkzeug.Response]: if 'text/html' not in request.accept_mimetypes: - return 429, "bot detected, HTTP header Accept did not contain text/html" + return too_many_requests(request, "HTTP header Accept did not contain text/html") return None |