Loading searx/poolrequests.py +3 −1 Original line number Diff line number Diff line Loading @@ -66,8 +66,10 @@ class SessionSinglePool(requests.Session): def request(method, url, **kwargs): """same as requests/requests/api.py request(...) except it use SessionSinglePool""" """same as requests/requests/api.py request(...) except it use SessionSinglePool and force proxies""" global settings session = SessionSinglePool() kwargs['proxies'] = settings.get('outgoing_proxies', None) response = session.request(method=method, url=url, **kwargs) session.close() return response Loading searx/settings.yml +7 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,13 @@ server: image_proxy : False # Proxying image results through searx default_locale : "" # Default interface locale - leave blank to detect from browser information or use codes from the 'locales' config section # uncomment below section if you want to use a proxy # see http://docs.python-requests.org/en/latest/user/advanced/#proxies # SOCKS proxies are not supported : see https://github.com/kennethreitz/requests/pull/478 #outgoing_proxies : # http : http://127.0.0.1:8080 # https: http://127.0.0.1:8080 # uncomment below section only if you have more than one network interface # which can be the source of outgoing search requests #source_ips: Loading searx/webapp.py +4 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,8 @@ _category_names = (gettext('files'), gettext('news'), gettext('map')) outgoing_proxies = settings.get('outgoing_proxies', None) @babel.localeselector def get_locale(): Loading Loading @@ -645,7 +647,8 @@ def image_proxy(): resp = requests.get(url, stream=True, timeout=settings['server'].get('request_timeout', 2), headers=headers) headers=headers, proxies=outgoing_proxies) if resp.status_code == 304: return '', resp.status_code Loading Loading
searx/poolrequests.py +3 −1 Original line number Diff line number Diff line Loading @@ -66,8 +66,10 @@ class SessionSinglePool(requests.Session): def request(method, url, **kwargs): """same as requests/requests/api.py request(...) except it use SessionSinglePool""" """same as requests/requests/api.py request(...) except it use SessionSinglePool and force proxies""" global settings session = SessionSinglePool() kwargs['proxies'] = settings.get('outgoing_proxies', None) response = session.request(method=method, url=url, **kwargs) session.close() return response Loading
searx/settings.yml +7 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,13 @@ server: image_proxy : False # Proxying image results through searx default_locale : "" # Default interface locale - leave blank to detect from browser information or use codes from the 'locales' config section # uncomment below section if you want to use a proxy # see http://docs.python-requests.org/en/latest/user/advanced/#proxies # SOCKS proxies are not supported : see https://github.com/kennethreitz/requests/pull/478 #outgoing_proxies : # http : http://127.0.0.1:8080 # https: http://127.0.0.1:8080 # uncomment below section only if you have more than one network interface # which can be the source of outgoing search requests #source_ips: Loading
searx/webapp.py +4 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,8 @@ _category_names = (gettext('files'), gettext('news'), gettext('map')) outgoing_proxies = settings.get('outgoing_proxies', None) @babel.localeselector def get_locale(): Loading Loading @@ -645,7 +647,8 @@ def image_proxy(): resp = requests.get(url, stream=True, timeout=settings['server'].get('request_timeout', 2), headers=headers) headers=headers, proxies=outgoing_proxies) if resp.status_code == 304: return '', resp.status_code Loading