__init__.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # SPDX-License-Identifier: AGPL-3.0-or-later
  2. # lint: pylint
  3. """Implementations of the framework for the SearXNG engines.
  4. .. hint::
  5. The long term goal is to modularize all implementations of the engine
  6. framework here in this Python package. ToDo:
  7. - move implementations of the :ref:`searx.engines loader` to a new module in
  8. the :py:obj:`searx.enginelib` namespace.
  9. """
  10. from __future__ import annotations
  11. from typing import List, Callable, TYPE_CHECKING
  12. if TYPE_CHECKING:
  13. from searx.enginelib import traits
  14. class Engine: # pylint: disable=too-few-public-methods
  15. """Class of engine instances build from YAML settings.
  16. Further documentation see :ref:`general engine configuration`.
  17. .. hint::
  18. This class is currently never initialized and only used for type hinting.
  19. """
  20. # Common options in the engine module
  21. engine_type: str
  22. """Type of the engine (:ref:`searx.search.processors`)"""
  23. paging: bool
  24. """Engine supports multiple pages."""
  25. time_range_support: bool
  26. """Engine supports search time range."""
  27. safesearch: bool
  28. """Engine supports SafeSearch"""
  29. language_support: bool
  30. """Engine supports languages (locales) search."""
  31. language: str
  32. """For an engine, when there is ``language: ...`` in the YAML settings the engine
  33. does support only this one language:
  34. .. code:: yaml
  35. - name: google french
  36. engine: google
  37. language: fr
  38. """
  39. region: str
  40. """For an engine, when there is ``region: ...`` in the YAML settings the engine
  41. does support only this one region::
  42. .. code:: yaml
  43. - name: google belgium
  44. engine: google
  45. region: fr-BE
  46. """
  47. fetch_traits: Callable
  48. """Function to to fetch engine's traits from origin."""
  49. traits: traits.EngineTraits
  50. """Traits of the engine."""
  51. # settings.yml
  52. categories: List[str]
  53. """Specifies to which :ref:`engine categories` the engine should be added."""
  54. name: str
  55. """Name that will be used across SearXNG to define this engine. In settings, on
  56. the result page .."""
  57. engine: str
  58. """Name of the python file used to handle requests and responses to and from
  59. this search engine (file name from :origin:`searx/engines` without
  60. ``.py``)."""
  61. enable_http: bool
  62. """Enable HTTP (by default only HTTPS is enabled)."""
  63. shortcut: str
  64. """Code used to execute bang requests (``!foo``)"""
  65. timeout: float
  66. """Specific timeout for search-engine."""
  67. display_error_messages: bool
  68. """Display error messages on the web UI."""
  69. proxies: dict
  70. """Set proxies for a specific engine (YAML):
  71. .. code:: yaml
  72. proxies :
  73. http: socks5://proxy:port
  74. https: socks5://proxy:port
  75. """
  76. disabled: bool
  77. """To disable by default the engine, but not deleting it. It will allow the
  78. user to manually activate it in the settings."""
  79. inactive: bool
  80. """Remove the engine from the settings (*disabled & removed*)."""
  81. about: dict
  82. """Additional fields describing the engine.
  83. .. code:: yaml
  84. about:
  85. website: https://example.com
  86. wikidata_id: Q306656
  87. official_api_documentation: https://example.com/api-doc
  88. use_official_api: true
  89. require_api_key: true
  90. results: HTML
  91. """
  92. using_tor_proxy: bool
  93. """Using tor proxy (``true``) or not (``false``) for this engine."""
  94. send_accept_language_header: bool
  95. """When this option is activated, the language (locale) that is selected by
  96. the user is used to build and send a ``Accept-Language`` header in the
  97. request to the origin search engine."""
  98. tokens: List[str]
  99. """A list of secret tokens to make this engine *private*, more details see
  100. :ref:`private engines`."""