mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Merge a9d1d1be70 into ac430a9eaf
This commit is contained in:
commit
fb6e212574
24 changed files with 2324 additions and 888 deletions
|
|
@ -168,8 +168,7 @@ if __name__ == '__main__':
|
|||
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.NETWORKS.initialize_from_settings(settings_engines, searx.settings['outgoing'], check=False)
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -207,7 +207,6 @@ def initialize():
|
|||
|
||||
def fetch_wikidata_descriptions():
|
||||
print('Fetching wikidata descriptions')
|
||||
searx.network.set_timeout_for_thread(60)
|
||||
result = wikidata.send_wikidata_query(
|
||||
SPARQL_DESCRIPTION.replace('%IDS%', IDS).replace('%LANGUAGES_SPARQL%', LANGUAGES_SPARQL)
|
||||
)
|
||||
|
|
@ -356,6 +355,7 @@ def get_output():
|
|||
return output
|
||||
|
||||
|
||||
@searx.network.networkcontext_decorator(timeout=60)
|
||||
def main():
|
||||
initialize()
|
||||
fetch_wikidata_descriptions()
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ lang2emoji = {
|
|||
}
|
||||
|
||||
|
||||
@network.networkcontext_decorator(timeout=60)
|
||||
def main():
|
||||
load_engines(settings['engines'])
|
||||
# traits_map = EngineTraitsMap.from_data()
|
||||
|
|
@ -86,7 +87,6 @@ def main():
|
|||
|
||||
def fetch_traits_map():
|
||||
"""Fetchs supported languages for each engine and writes json file with those."""
|
||||
network.set_timeout_for_thread(10.0)
|
||||
|
||||
def log(msg):
|
||||
print(msg)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ Output file: :origin:`searx/data/osm_keys_tags` (:origin:`CI Update data ...
|
|||
import json
|
||||
import collections
|
||||
|
||||
from searx.network import set_timeout_for_thread
|
||||
from searx.network import networkcontext_decorator
|
||||
from searx.engines import wikidata, set_loggers
|
||||
from searx.sxng_locales import sxng_locales
|
||||
from searx.engines.openstreetmap import get_key_rank, VALUE_TO_LINK
|
||||
|
|
@ -203,12 +203,15 @@ def optimize_keys(data):
|
|||
return data
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
set_timeout_for_thread(60)
|
||||
@networkcontext_decorator(timeout=60)
|
||||
def main():
|
||||
result = {
|
||||
'keys': optimize_keys(get_keys()),
|
||||
'tags': optimize_tags(get_tags()),
|
||||
}
|
||||
with DATA_FILE.open('w', encoding="utf8") as f:
|
||||
json.dump(result, f, indent=4, sort_keys=True, ensure_ascii=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue