Browse Source

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

Adam Tauber 7 years ago
parent
commit
f2b13a7de0
2 changed files with 3 additions and 3 deletions
  1. 1
    1
      searx/poolrequests.py
  2. 2
    2
      searx/webapp.py

+ 1
- 1
searx/poolrequests.py View File

75
 def request(method, url, **kwargs):
75
 def request(method, url, **kwargs):
76
     """same as requests/requests/api.py request(...) except it use SessionSinglePool and force proxies"""
76
     """same as requests/requests/api.py request(...) except it use SessionSinglePool and force proxies"""
77
     session = SessionSinglePool()
77
     session = SessionSinglePool()
78
-    kwargs['proxies'] = settings['outgoing'].get('proxies', None)
78
+    kwargs['proxies'] = settings['outgoing'].get('proxies') or None
79
     response = session.request(method=method, url=url, **kwargs)
79
     response = session.request(method=method, url=url, **kwargs)
80
     session.close()
80
     session.close()
81
     return response
81
     return response

+ 2
- 2
searx/webapp.py View File

142
                    gettext('map'),
142
                    gettext('map'),
143
                    gettext('science'))
143
                    gettext('science'))
144
 
144
 
145
-outgoing_proxies = settings['outgoing'].get('proxies', None)
145
+outgoing_proxies = settings['outgoing'].get('proxies') or None
146
 
146
 
147
 
147
 
148
 @babel.localeselector
148
 @babel.localeselector
353
 
353
 
354
     kwargs['image_proxify'] = image_proxify
354
     kwargs['image_proxify'] = image_proxify
355
 
355
 
356
-    kwargs['proxify'] = proxify if settings.get('result_proxy') else None
356
+    kwargs['proxify'] = proxify if settings.get('result_proxy', {}).get('url') else None
357
 
357
 
358
     kwargs['get_result_template'] = get_result_template
358
     kwargs['get_result_template'] = get_result_template
359
 
359