summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/utils.py')
-rw-r--r--searx/utils.py15
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 {}