summaryrefslogtreecommitdiff
path: root/searx_extra/update/update_wikidata_units.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2021-09-19 09:10:02 +0000
committerGitHub <noreply@github.com>2021-09-19 11:10:02 +0200
commit55b30b5b494a59c62e9e7d1a5cb6fdbf8729f64f (patch)
tree989edd788cfa24e033a42e29f7aa802f4206cd03 /searx_extra/update/update_wikidata_units.py
parentd95c46d64617edddbb36a7f764e1affaafa551fc (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_wikidata_units.py')
-rwxr-xr-xsearx_extra/update/update_wikidata_units.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/searx_extra/update/update_wikidata_units.py b/searx_extra/update/update_wikidata_units.py
index 1e6b8b9ca..ddde4c135 100755
--- a/searx_extra/update/update_wikidata_units.py
+++ b/searx_extra/update/update_wikidata_units.py
@@ -7,13 +7,14 @@ import collections
from os.path import join
from searx import searx_dir
-from searx.engines.wikidata import send_wikidata_query
+from searx.engines import wikidata, set_loggers
+set_loggers(wikidata, 'wikidata')
# the response contains duplicate ?item with the different ?symbol
# "ORDER BY ?item DESC(?rank) ?symbol" provides a deterministic result
# even if a ?item has different ?symbol of the same rank.
-# A deterministic result
+# A deterministic result
# see:
# * https://www.wikidata.org/wiki/Help:Ranking
# * https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format ("Statement representation" section)
@@ -36,7 +37,7 @@ ORDER BY ?item DESC(?rank) ?symbol
def get_data():
results = collections.OrderedDict()
- response = send_wikidata_query(SARQL_REQUEST)
+ response = wikidata.send_wikidata_query(SARQL_REQUEST)
for unit in response['results']['bindings']:
name = unit['item']['value'].replace('http://www.wikidata.org/entity/', '')
unit = unit['symbol']['value']