diff options
| author | Markus Heiser <markus.heiser@darmarIT.de> | 2021-09-19 09:10:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-19 11:10:02 +0200 |
| commit | 55b30b5b494a59c62e9e7d1a5cb6fdbf8729f64f (patch) | |
| tree | 989edd788cfa24e033a42e29f7aa802f4206cd03 /searx_extra/update/update_engine_descriptions.py | |
| parent | d95c46d64617edddbb36a7f764e1affaafa551fc (diff) | |
[fix] searx_extra/update scripts: set_loggers(wikidata, 'wikidata') (#331)
* [fix] searx_extra/update scripts: set_loggers(wikidata, 'wikidata')
To test use::
./manage pyenv.cmd searx_extra/update/update_currencies.py
./manage pyenv.cmd searx_extra/update/update_osm_keys_tags.py
./manage pyenv.cmd searx_extra/update/update_wikidata_units.py
The script `update_engine_descriptions.py` seems to have some issues not related
to this patch.
./manage pyenv.cmd python -m pip install -U pycld3
./manage pyenv.cmd searx_extra/update/update_engine_descriptions.py
Closes: https://github.com/searxng/searxng/issues/328
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx_extra/update/update_engine_descriptions.py')
| -rwxr-xr-x | searx_extra/update/update_engine_descriptions.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/searx_extra/update/update_engine_descriptions.py b/searx_extra/update/update_engine_descriptions.py index 37be77177..2a05790da 100755 --- a/searx_extra/update/update_engine_descriptions.py +++ b/searx_extra/update/update_engine_descriptions.py @@ -6,13 +6,15 @@ from urllib.parse import quote, urlparse import detect_language from lxml.html import fromstring -from searx.engines.wikidata import send_wikidata_query +from searx.engines import wikidata, set_loggers from searx.utils import extract_text from searx.locales import LOCALE_NAMES import searx import searx.search import searx.network +set_loggers(wikidata, 'wikidata') + SPARQL_WIKIPEDIA_ARTICLE = """ SELECT DISTINCT ?item ?name WHERE { @@ -128,9 +130,11 @@ def initialize(): def fetch_wikidata_descriptions(): global IDS - result = send_wikidata_query(SPARQL_DESCRIPTION - .replace('%IDS%', IDS) - .replace('%LANGUAGES_SPARQL%', LANGUAGES_SPARQL)) + result = wikidata.send_wikidata_query( + SPARQL_DESCRIPTION + .replace('%IDS%', IDS) + .replace('%LANGUAGES_SPARQL%', LANGUAGES_SPARQL) + ) if result is not None: for binding in result['results']['bindings']: wikidata_id = binding['item']['value'].replace('http://www.wikidata.org/entity/', '') @@ -143,9 +147,11 @@ def fetch_wikidata_descriptions(): def fetch_wikipedia_descriptions(): global IDS - result = send_wikidata_query(SPARQL_WIKIPEDIA_ARTICLE - .replace('%IDS%', IDS) - .replace('%LANGUAGES_SPARQL%', LANGUAGES_SPARQL)) + result = wikidata.send_wikidata_query( + SPARQL_WIKIPEDIA_ARTICLE + .replace('%IDS%', IDS) + .replace('%LANGUAGES_SPARQL%', LANGUAGES_SPARQL) + ) if result is not None: for binding in result['results']['bindings']: wikidata_id = binding['item']['value'].replace('http://www.wikidata.org/entity/', '') |