Load Engines

This module implements the engine loader.

Load and initialize the engines, see load_engines() and register engine_shortcuts.

usage:

load_engines( settings['engines'] )
class searx.engines.Engine[source]

This class is currently never initialized and only used for type hinting.

searx.engines.engine_shortcuts

Simple map of registered shortcuts to name of the engine (or None).

engine_shortcuts[engine.shortcut] = engine.name
searx.engines.is_missing_required_attributes(engine)[source]

An attribute is required when its name doesn’t start with _ (underline). Required attributes must not be None.

searx.engines.load_engine(engine_data: dict) Optional[Engine][source]

Load engine from engine_data.

Parameters:

engine_data (dict) – Attributes from YAML settings:engines/<engine>

Returns:

initialized namespace of the <engine>.

  1. create a namespace and load module of the <engine>

  2. update namespace with the defaults from ENGINE_DEFAULT_ARGS

  3. update namespace with values from engine_data

If engine is active, return namespace of the engine, otherwise return None.

This function also returns None if initialization of the namespace fails for one of the following reasons:

searx.engines.load_engines(engine_list)[source]

usage: engine_list = settings['engines']

searx.engines.using_tor_proxy(engine: Engine)[source]

Return True if the engine configuration declares to use Tor.