logo

searx

Unnamed repository; edit this file 'description' to name the repository.
commit: f2b13a7de071cd68c9aeef7ff3e87ede88e677e8
parent: 1794f6a4d36cafcc4eb2a64e0145d937bc81bc34
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Wed, 19 Jul 2017 21:33:44 +0200

[enh] allow default empty values for normal and result proxies

Diffstat:

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 @@ -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 @@ -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