summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2021-12-27 08:10:04 +0100
committerGitHub <noreply@github.com>2021-12-27 08:10:04 +0100
commit54bce130f9074c3d63009237b014c727a1443cc5 (patch)
treef95b5f1b85802793e32cc885ee5e1064d7b36fa2
parent6ffa741e7a739a8b7df210054300dda8c33d75b7 (diff)
parent9215d4cde72edadd763bd212209ead861ed7eebd (diff)
downloadsearxng-54bce130f9074c3d63009237b014c727a1443cc5.tar.gz
searxng-54bce130f9074c3d63009237b014c727a1443cc5.zip
Merge pull request #658 from dalf/fix-standalone-script
Fix standalone script
-rw-r--r--searxng_extra/google_search.py37
-rwxr-xr-xsearxng_extra/standalone_searx.py7
2 files changed, 6 insertions, 38 deletions
diff --git a/searxng_extra/google_search.py b/searxng_extra/google_search.py
deleted file mode 100644
index 34b40c0f2..000000000
--- a/searxng_extra/google_search.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# SPDX-License-Identifier: AGPL-3.0-or-later
-
-from sys import argv, exit
-
-if not len(argv) > 1:
- print('search query required')
- exit(1)
-
-import requests
-from json import dumps
-from searx.engines import google
-from searx.search import default_request_params
-
-request_params = default_request_params()
-# Possible params
-# request_params['headers']['User-Agent'] = ''
-# request_params['category'] = ''
-request_params['pageno'] = 1
-request_params['language'] = 'en_us'
-request_params['time_range'] = ''
-
-params = google.request(argv[1], request_params)
-
-request_args = dict(
- headers=request_params['headers'],
- cookies=request_params['cookies'],
-)
-
-if request_params['method'] == 'GET':
- req = requests.get
-else:
- req = requests.post
- request_args['data'] = request_params['data']
-
-resp = req(request_params['url'], **request_args)
-resp.search_params = request_params
-print(dumps(google.response(resp)))
diff --git a/searxng_extra/standalone_searx.py b/searxng_extra/standalone_searx.py
index e243d9cb1..de8a0d77f 100755
--- a/searxng_extra/standalone_searx.py
+++ b/searxng_extra/standalone_searx.py
@@ -196,9 +196,14 @@ def parse_argument(
if __name__ == '__main__':
- searx.search.initialize()
+ settings_engines = searx.settings['engines']
+ searx.search.load_engines(settings_engines)
engine_cs = list(searx.engines.categories.keys())
prog_args = parse_argument(category_choices=engine_cs)
+ searx.search.initialize_network(settings_engines, searx.settings['outgoing'])
+ searx.search.check_network_configuration()
+ searx.search.initialize_metrics([engine['name'] for engine in settings_engines])
+ searx.search.initialize_processors(settings_engines)
search_q = get_search_query(prog_args, engine_categories=engine_cs)
res_dict = to_dict(search_q)
sys.stdout.write(dumps(