SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[mod] poolrequests: for one (user request, engine) always use the same HTTPAdapter
Alexandre Flament74d56f6cfb0d
diff --git a/searx/poolrequests.py b/searx/poolrequests.pyindex 25a6baed9..8b8681437 100644--- a/searx/poolrequests.py+++ b/searx/poolrequests.py@@ -1,7 +1,7 @@import sysfrom time import timefrom itertools import cycle-from threading import RLock, local+from threading import localimport requests@@ -88,10 +88,12 @@ class SessionSinglePool(requests.Session):super().__init__()# reuse the same adapters- with RLock():- self.adapters.clear()- self.mount('https://', next(https_adapters))- self.mount('http://', next(http_adapters))+ self.adapters.clear()++ https_adapter = threadLocal.__dict__.setdefault('https_adapter', next(https_adapters))+ http_adapter = threadLocal.__dict__.setdefault('http_adapter', next(http_adapters))+ self.mount('https://', https_adapter)+ self.mount('http://', http_adapter)def close(self):"""Call super, but clear adapters since there are managed globaly"""