Loading searx/engines/qwant.py +2 −0 Original line number Original line Diff line number Diff line Loading @@ -93,6 +93,8 @@ def request(query, params): supported_languages, supported_languages, language_aliases, language_aliases, ) ) if language not in supported_languages: language = 'en-US' params['url'] += '&locale=' + language.replace('-', '_') params['url'] += '&locale=' + language.replace('-', '_') params['raise_for_httperror'] = False params['raise_for_httperror'] = False Loading searx/settings.yml +3 −10 Original line number Original line Diff line number Diff line Loading @@ -412,7 +412,7 @@ engines: - name: wikidata - name: wikidata engine: wikidata engine: wikidata shortcut: wd shortcut: wd timeout: 3.0 timeout: 6.0 weight: 2 weight: 2 tests: *tests_infobox tests: *tests_infobox Loading Loading @@ -589,6 +589,7 @@ engines: - name : google images - name : google images engine : google_images engine : google_images shortcut : goi shortcut : goi timeout: 6.0 # additional_tests: # additional_tests: # android: *test_android # android: *test_android # dali: # dali: Loading Loading @@ -741,19 +742,11 @@ engines: - name : invidious - name : invidious engine : invidious engine : invidious base_url : base_url : https://invidious.weblibre.org/ - https://invidious.tube/ - https://invidious.snopyta.org/ shortcut: iv shortcut: iv timeout : 5.0 timeout : 5.0 disabled : True disabled : True - name: kickass engine : kickass shortcut : kc timeout : 4.0 disabled : True - name : library genesis - name : library genesis engine : xpath engine : xpath paging : True paging : True Loading searx/webapp.py +1 −1 Original line number Original line Diff line number Diff line Loading @@ -619,7 +619,7 @@ def search(): # output_format # output_format output_format = request.form.get('format', 'html') output_format = request.form.get('format', 'html') if output_format not in ['html', 'csv', 'json', 'rss']: if output_format not in ['html', 'rss']: output_format = 'html' output_format = 'html' # check if there is query (not None and not an empty string) # check if there is query (not None and not an empty string) Loading tests/unit/test_webapp.py +0 −36 Original line number Original line Diff line number Diff line # -*- coding: utf-8 -*- # -*- coding: utf-8 -*- import json from urllib.parse import ParseResult from urllib.parse import ParseResult from mock import Mock from mock import Mock from searx.testing import SearxTestCase from searx.testing import SearxTestCase Loading Loading @@ -98,14 +97,6 @@ class ViewsTestCase(SearxTestCase): self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200) self.assertIn(b'<span class="instance pull-left"><a href="/">Spot</a></span>', result.data) self.assertIn(b'<span class="instance pull-left"><a href="/">Spot</a></span>', result.data) def test_search_empty_json(self): result = self.app.post('/search', data={'q': '', 'format': 'json'}) self.assertEqual(result.status_code, 400) def test_search_empty_csv(self): result = self.app.post('/search', data={'q': '', 'format': 'csv'}) self.assertEqual(result.status_code, 400) def test_search_empty_rss(self): def test_search_empty_rss(self): result = self.app.post('/search', data={'q': '', 'format': 'rss'}) result = self.app.post('/search', data={'q': '', 'format': 'rss'}) self.assertEqual(result.status_code, 400) self.assertEqual(result.status_code, 400) Loading @@ -124,33 +115,6 @@ class ViewsTestCase(SearxTestCase): result.data result.data ) ) def test_index_json(self): result = self.app.post('/', data={'q': 'test', 'format': 'json'}) self.assertEqual(result.status_code, 308) def test_search_json(self): result = self.app.post('/search', data={'q': 'test', 'format': 'json'}) result_dict = json.loads(result.data.decode()) self.assertEqual('test', result_dict['query']) self.assertEqual(len(result_dict['results']), 2) self.assertEqual(result_dict['results'][0]['content'], 'first test content') self.assertEqual(result_dict['results'][0]['url'], 'http://first.test.xyz') def test_index_csv(self): result = self.app.post('/', data={'q': 'test', 'format': 'csv'}) self.assertEqual(result.status_code, 308) def test_search_csv(self): result = self.app.post('/search', data={'q': 'test', 'format': 'csv'}) self.assertEqual( b'title,url,content,host,engine,score,type\r\n' b'First Test,http://first.test.xyz,first test content,first.test.xyz,startpage,,result\r\n' # noqa b'Second Test,http://second.test.xyz,second test content,second.test.xyz,youtube,,result\r\n', # noqa result.data ) def test_index_rss(self): def test_index_rss(self): result = self.app.post('/', data={'q': 'test', 'format': 'rss'}) result = self.app.post('/', data={'q': 'test', 'format': 'rss'}) self.assertEqual(result.status_code, 308) self.assertEqual(result.status_code, 308) Loading Loading
searx/engines/qwant.py +2 −0 Original line number Original line Diff line number Diff line Loading @@ -93,6 +93,8 @@ def request(query, params): supported_languages, supported_languages, language_aliases, language_aliases, ) ) if language not in supported_languages: language = 'en-US' params['url'] += '&locale=' + language.replace('-', '_') params['url'] += '&locale=' + language.replace('-', '_') params['raise_for_httperror'] = False params['raise_for_httperror'] = False Loading
searx/settings.yml +3 −10 Original line number Original line Diff line number Diff line Loading @@ -412,7 +412,7 @@ engines: - name: wikidata - name: wikidata engine: wikidata engine: wikidata shortcut: wd shortcut: wd timeout: 3.0 timeout: 6.0 weight: 2 weight: 2 tests: *tests_infobox tests: *tests_infobox Loading Loading @@ -589,6 +589,7 @@ engines: - name : google images - name : google images engine : google_images engine : google_images shortcut : goi shortcut : goi timeout: 6.0 # additional_tests: # additional_tests: # android: *test_android # android: *test_android # dali: # dali: Loading Loading @@ -741,19 +742,11 @@ engines: - name : invidious - name : invidious engine : invidious engine : invidious base_url : base_url : https://invidious.weblibre.org/ - https://invidious.tube/ - https://invidious.snopyta.org/ shortcut: iv shortcut: iv timeout : 5.0 timeout : 5.0 disabled : True disabled : True - name: kickass engine : kickass shortcut : kc timeout : 4.0 disabled : True - name : library genesis - name : library genesis engine : xpath engine : xpath paging : True paging : True Loading
searx/webapp.py +1 −1 Original line number Original line Diff line number Diff line Loading @@ -619,7 +619,7 @@ def search(): # output_format # output_format output_format = request.form.get('format', 'html') output_format = request.form.get('format', 'html') if output_format not in ['html', 'csv', 'json', 'rss']: if output_format not in ['html', 'rss']: output_format = 'html' output_format = 'html' # check if there is query (not None and not an empty string) # check if there is query (not None and not an empty string) Loading
tests/unit/test_webapp.py +0 −36 Original line number Original line Diff line number Diff line # -*- coding: utf-8 -*- # -*- coding: utf-8 -*- import json from urllib.parse import ParseResult from urllib.parse import ParseResult from mock import Mock from mock import Mock from searx.testing import SearxTestCase from searx.testing import SearxTestCase Loading Loading @@ -98,14 +97,6 @@ class ViewsTestCase(SearxTestCase): self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200) self.assertIn(b'<span class="instance pull-left"><a href="/">Spot</a></span>', result.data) self.assertIn(b'<span class="instance pull-left"><a href="/">Spot</a></span>', result.data) def test_search_empty_json(self): result = self.app.post('/search', data={'q': '', 'format': 'json'}) self.assertEqual(result.status_code, 400) def test_search_empty_csv(self): result = self.app.post('/search', data={'q': '', 'format': 'csv'}) self.assertEqual(result.status_code, 400) def test_search_empty_rss(self): def test_search_empty_rss(self): result = self.app.post('/search', data={'q': '', 'format': 'rss'}) result = self.app.post('/search', data={'q': '', 'format': 'rss'}) self.assertEqual(result.status_code, 400) self.assertEqual(result.status_code, 400) Loading @@ -124,33 +115,6 @@ class ViewsTestCase(SearxTestCase): result.data result.data ) ) def test_index_json(self): result = self.app.post('/', data={'q': 'test', 'format': 'json'}) self.assertEqual(result.status_code, 308) def test_search_json(self): result = self.app.post('/search', data={'q': 'test', 'format': 'json'}) result_dict = json.loads(result.data.decode()) self.assertEqual('test', result_dict['query']) self.assertEqual(len(result_dict['results']), 2) self.assertEqual(result_dict['results'][0]['content'], 'first test content') self.assertEqual(result_dict['results'][0]['url'], 'http://first.test.xyz') def test_index_csv(self): result = self.app.post('/', data={'q': 'test', 'format': 'csv'}) self.assertEqual(result.status_code, 308) def test_search_csv(self): result = self.app.post('/search', data={'q': 'test', 'format': 'csv'}) self.assertEqual( b'title,url,content,host,engine,score,type\r\n' b'First Test,http://first.test.xyz,first test content,first.test.xyz,startpage,,result\r\n' # noqa b'Second Test,http://second.test.xyz,second test content,second.test.xyz,youtube,,result\r\n', # noqa result.data ) def test_index_rss(self): def test_index_rss(self): result = self.app.post('/', data={'q': 'test', 'format': 'rss'}) result = self.app.post('/', data={'q': 'test', 'format': 'rss'}) self.assertEqual(result.status_code, 308) self.assertEqual(result.status_code, 308) Loading