summaryrefslogtreecommitdiff
path: root/searx/engines/bing.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/engines/bing.py')
-rw-r--r--searx/engines/bing.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/searx/engines/bing.py b/searx/engines/bing.py
index d4f46eaaf..da76f771e 100644
--- a/searx/engines/bing.py
+++ b/searx/engines/bing.py
@@ -192,8 +192,21 @@ def fetch_traits(engine_traits: EngineTraits):
# pylint: disable=import-outside-toplevel
from searx.network import get # see https://github.com/searxng/searxng/issues/762
+ from searx.utils import gen_useragent
+
+ headers = {
+ "User-Agent": gen_useragent(),
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
+ "Accept-Language": "en-US;q=0.5,en;q=0.3",
+ "Accept-Encoding": "gzip, deflate, br",
+ "DNT": "1",
+ "Connection": "keep-alive",
+ "Upgrade-Insecure-Requests": "1",
+ "Sec-GPC": "1",
+ "Cache-Control": "max-age=0",
+ }
- resp = get("https://www.bing.com/account/general")
+ resp = get("https://www.bing.com/account/general", headers=headers)
if not resp.ok: # type: ignore
print("ERROR: response from bing is not OK.")