From f2b13a7de071cd68c9aeef7ff3e87ede88e677e8 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Wed, 19 Jul 2017 21:33:44 +0200 Subject: [PATCH] [enh] allow default empty values for normal and result proxies --- searx/poolrequests.py | 2 +- searx/webapp.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/searx/poolrequests.py b/searx/poolrequests.py index f268df207..628fd5dff 100644 --- a/searx/poolrequests.py +++ b/searx/poolrequests.py @@ -75,7 +75,7 @@ class SessionSinglePool(requests.Session): def request(method, url, **kwargs): """same as requests/requests/api.py request(...) except it use SessionSinglePool and force proxies""" session = SessionSinglePool() - kwargs['proxies'] = settings['outgoing'].get('proxies', None) + kwargs['proxies'] = settings['outgoing'].get('proxies') or None response = session.request(method=method, url=url, **kwargs) session.close() return response diff --git a/searx/webapp.py b/searx/webapp.py index 1e66590c1..3afdbefd8 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -142,7 +142,7 @@ _category_names = (gettext('files'), gettext('map'), gettext('science')) -outgoing_proxies = settings['outgoing'].get('proxies', None) +outgoing_proxies = settings['outgoing'].get('proxies') or None @babel.localeselector @@ -353,7 +353,7 @@ def render(template_name, override_theme=None, **kwargs): kwargs['image_proxify'] = image_proxify - kwargs['proxify'] = proxify if settings.get('result_proxy') else None + kwargs['proxify'] = proxify if settings.get('result_proxy', {}).get('url') else None kwargs['get_result_template'] = get_result_template