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