diff options
author | Noémi Ványi <sitbackandwait@gmail.com> | 2019-09-23 17:14:32 +0200 |
---|---|---|
committer | Noémi Ványi <sitbackandwait@gmail.com> | 2019-10-16 15:52:48 +0200 |
commit | a6f20caf32af463b57a026ee7cb7ed6317db6b8b (patch) | |
tree | c180f804d1a80767ab50b7cffb42aa75f9c3806a /searx/utils.py | |
parent | 2946c5f10695634be1f1266142bec5572139085f (diff) | |
download | searxng-a6f20caf32af463b57a026ee7cb7ed6317db6b8b.tar.gz searxng-a6f20caf32af463b57a026ee7cb7ed6317db6b8b.zip |
add initial support for offline engines && command engine
Diffstat (limited to 'searx/utils.py')
-rw-r--r-- | searx/utils.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/searx/utils.py b/searx/utils.py index eb5da2fa7..4029cf2ae 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -435,3 +435,18 @@ def ecma_unescape(s): # "%20" becomes " ", "%F3" becomes "ó" s = ecma_unescape2_re.sub(lambda e: unichr(int(e.group(1), 16)), s) return s + + +def get_engine_from_settings(name): + """Return engine configuration from settings.yml of a given engine name""" + + if 'engines' not in settings: + return {} + + for engine in settings['engines']: + if 'name' not in engine: + continue + if name == engine['name']: + return engine + + return {} |