.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
http_accept_language.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: AGPL-3.0-or-later
2
"""
3
Method ``http_accept_language``
4
-------------------------------
5
6
The ``http_accept_language`` method evaluates a request as the request of a bot
7
if the Accept-Language_ header is unset.
8
9
.. _Accept-Language:
10
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
11
12
"""
13
# pylint: disable=unused-argument
14
from
__future__
import
annotations
15
from
ipaddress
import
(
16
IPv4Network,
17
IPv6Network,
18
)
19
20
import
flask
21
import
werkzeug
22
23
from
.
import
config
24
from
._helpers
import
too_many_requests
25
26
27
def
filter_request
(
28
network: IPv4Network | IPv6Network,
29
request: flask.Request,
30
cfg:
config.Config
,
31
) -> werkzeug.Response |
None
:
32
if
request.headers.get(
'Accept-Language'
,
''
).strip() ==
''
:
33
return
too_many_requests(network,
"missing HTTP header Accept-Language"
)
34
return
None
searx.botdetection.config.Config
Definition
config.py:54
searx.botdetection.http_accept_language.filter_request
werkzeug.Response|None filter_request(IPv4Network|IPv6Network network, flask.Request request, config.Config cfg)
Definition
http_accept_language.py:31
searxng
searx
botdetection
http_accept_language.py
Generated on Sat Nov 16 2024 00:10:57 for .oO SearXNG Developer Documentation Oo. by
1.12.0