ソースを参照

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

Adam Tauber 7 年 前
コミット
f2b13a7de0
共有2 個のファイルを変更した3 個の追加3 個の削除を含む
  1. 1
    1
      searx/poolrequests.py
  2. 2
    2
      searx/webapp.py

+ 1
- 1
searx/poolrequests.py ファイルの表示

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

+ 2
- 2
searx/webapp.py ファイルの表示

@@ -142,7 +142,7 @@ _category_names = (gettext('files'),
142 142
                    gettext('map'),
143 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 148
 @babel.localeselector
@@ -353,7 +353,7 @@ def render(template_name, override_theme=None, **kwargs):
353 353
 
354 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 358
     kwargs['get_result_template'] = get_result_template
359 359