diff options
Diffstat (limited to 'searx')
| -rw-r--r-- | searx/plugins/__init__.py | 13 | ||||
| -rw-r--r-- | searx/search/checker/background.py | 3 | ||||
| -rw-r--r-- | searx/settings.yml | 14 |
3 files changed, 20 insertions, 10 deletions
diff --git a/searx/plugins/__init__.py b/searx/plugins/__init__.py index 45b210662..3a35f7025 100644 --- a/searx/plugins/__init__.py +++ b/searx/plugins/__init__.py @@ -40,7 +40,8 @@ required_attrs = (('name', str), ('default_on', bool)) optional_attrs = (('js_dependencies', tuple), - ('css_dependencies', tuple)) + ('css_dependencies', tuple), + ('preference_section', str)) class Plugin(): @@ -63,9 +64,17 @@ class PluginStore(): plugins = load_external_plugins(plugins) for plugin in plugins: for plugin_attr, plugin_attr_type in required_attrs: - if not hasattr(plugin, plugin_attr) or not isinstance(getattr(plugin, plugin_attr), plugin_attr_type): + if not hasattr(plugin, plugin_attr): logger.critical('missing attribute "{0}", cannot load plugin: {1}'.format(plugin_attr, plugin)) exit(3) + attr = getattr(plugin, plugin_attr) + if not isinstance(attr, plugin_attr_type): + type_attr = str(type(attr)) + logger.critical( + 'attribute "{0}" is of type {2}, must be of type {3}, cannot load plugin: {1}' + .format(plugin_attr, plugin, type_attr, plugin_attr_type) + ) + exit(3) for plugin_attr, plugin_attr_type in optional_attrs: if not hasattr(plugin, plugin_attr) or not isinstance(getattr(plugin, plugin_attr), plugin_attr_type): setattr(plugin, plugin_attr, plugin_attr_type()) diff --git a/searx/search/checker/background.py b/searx/search/checker/background.py index 4c2750b44..f79a5d2df 100644 --- a/searx/search/checker/background.py +++ b/searx/search/checker/background.py @@ -36,10 +36,11 @@ def _get_every(): return _get_interval(every, 'checker.scheduling.every is not a int or list') -def get_result(): # pylint: disable=inconsistent-return-statements +def get_result(): serialized_result = storage.get_str(CHECKER_RESULT) if serialized_result is not None: return json.loads(serialized_result) + return {'status': 'unknown'} def _set_result(result, include_timestamp=True): diff --git a/searx/settings.yml b/searx/settings.yml index f4321b89d..1e5216a43 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -232,7 +232,7 @@ engines: about: website: https://archive.is/ wikidata_id: Q13515725 - official_api_documentation: http://mementoweb.org/depot/native/archiveis/ + official_api_documentation: https://mementoweb.org/depot/native/archiveis/ use_official_api: false require_api_key: false results: HTML @@ -758,7 +758,7 @@ engines: - name: library genesis engine: xpath enable_http: true - search_url: http://libgen.rs/search.php?req={query} + search_url: https://libgen.rs/search.php?req={query} url_xpath: //a[contains(@href,"bookfi.net/md5")]/@href title_xpath: //a[contains(@href,"book/")]/text()[1] content_xpath: //td/a[1][contains(@href,"=author")]/text() @@ -767,7 +767,7 @@ engines: disabled: true shortcut: lg about: - website: http://libgen.rs/ + website: https://libgen.rs/ wikidata_id: Q22017206 official_api_documentation: use_official_api: false @@ -1201,7 +1201,7 @@ engines: # tmp suspended - too slow, too many errors # - name: urbandictionary # engine : xpath - # search_url : http://www.urbandictionary.com/define.php?term={query} + # search_url : https://www.urbandictionary.com/define.php?term={query} # url_xpath : //*[@class="word"]/@href # title_xpath : //*[@class="def-header"] # content_xpath: //*[@class="meaning"] @@ -1345,7 +1345,7 @@ engines: - name: wolframalpha shortcut: wa # You can use the engine using the official stable API, but you need an API - # key. See: http://products.wolframalpha.com/api/ + # key. See: https://products.wolframalpha.com/api/ # # engine: wolframalpha_api # api_key: '' @@ -1365,7 +1365,7 @@ engines: timeout: 5.0 disabled: true # You can use without an API key, but you are limited to 1000 words/day - # See: http://mymemory.translated.net/doc/usagelimits.php + # See: https://mymemory.translated.net/doc/usagelimits.php # api_key: '' # Required dependency: mysql-connector-python @@ -1578,7 +1578,7 @@ engines: # - name: ubuntuwiki # engine: doku # shortcut: uw -# base_url: 'http://doc.ubuntu-fr.org' +# base_url: 'https://doc.ubuntu-fr.org' # Be careful when enabling this engine if you are # running a public instance. Do not expose any sensitive |