summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2026-09-02 16:29:33 +0200
committerBnyro <bnyro@tutanota.com>2026-09-03 10:03:05 +0200
commit8f452ee89293d9a752a776f4c33f5a5f124fff97 (patch)
tree9a67628778a03109d02e30a28442918c6dc88ba7
parent745d5b6fc506da30b3f275a80497de5d509df540 (diff)
[fix] chatnoir: fails to extract API session parameters
-rw-r--r--searx/engines/chatnoir.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/searx/engines/chatnoir.py b/searx/engines/chatnoir.py
index 3123d6c68..ef4a34e60 100644
--- a/searx/engines/chatnoir.py
+++ b/searx/engines/chatnoir.py
@@ -41,7 +41,7 @@ search_index = "cw22"
<https://www.chatnoir.eu/docs/api-general>`_ for a full list."""
-def _obtain_api_key() -> tuple[str, str, str]:
+def _obtain_api_key() -> tuple[str, str]:
home_resp = get(base_url)
if not home_resp.ok:
raise SearxEngineAPIException("failed to obtain api key")
@@ -58,10 +58,9 @@ def _obtain_api_key() -> tuple[str, str, str]:
)
if not token_resp.ok:
raise SearxEngineAPIException("failed to obtain api key")
- session_id = token_resp.cookies["sessionid"]
scraped_api_key = token_resp.json()["token"]["token"]
- return csrf_token, session_id, scraped_api_key
+ return csrf_token, scraped_api_key
def request(query: str, params: "OnlineParams"):
@@ -73,7 +72,7 @@ def request(query: str, params: "OnlineParams"):
params["headers"].update(headers)
else:
- csrf_token, session_id, scraped_api_key = _obtain_api_key()
+ csrf_token, scraped_api_key = _obtain_api_key()
headers = {
"Authorization": f"Bearer {scraped_api_key}",
@@ -81,7 +80,7 @@ def request(query: str, params: "OnlineParams"):
}
params["headers"].update(headers)
- params["cookies"] = {"csrftoken": session_id, "sessionid": session_id}
+ params["cookies"] = {"csrftoken": csrf_token}
params["url"] = f"{base_url}/api/v1/_search"
params["method"] = "POST"