__init__.py 3.7 KB

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