.oO SearXNG Developer Documentation Oo.
|
Classes | |
class | CSVWriter |
class | JSONEncoder |
Functions | |
get_translated_errors (Iterable[UnresponsiveEngine] unresponsive_engines) | |
None | write_csv_response (CSVWriter csv, ResultContainer rc) |
str | get_json_response (SearchQuery sq, ResultContainer rc) |
get_themes (templates_path) | |
str | get_hash_for_file (pathlib.Path file) |
Dict[str, str] | get_static_files (str static_path) |
get_result_templates (templates_path) | |
new_hmac (secret_key, url) | |
is_hmac_of (secret_key, value, hmac_to_check) | |
prettify_url (url, max_length=74) | |
bool | contains_cjko (str s) |
str | regex_highlight_cjk (str word) |
highlight_content (content, query) | |
str | searxng_l10n_timespan (datetime dt) |
List[Tuple[str, Iterable[Engine]]] | group_engines_in_tab (Iterable[Engine] engines) |
Variables | |
VALID_LANGUAGE_CODE = re.compile(r'^[a-z]{2,3}(-[a-zA-Z]{2})?$') | |
logger = logger.getChild('webutils') | |
timeout_text = gettext('timeout') | |
parsing_error_text = gettext('parsing error') | |
http_protocol_error_text = gettext('HTTP protocol error') | |
network_error_text = gettext('network error') | |
ssl_cert_error_text = gettext("SSL error: certificate validation has failed") | |
dict | exception_classname_to_text |
str | NO_SUBGROUPING = 'without further subgrouping' |
bool searx.webutils.contains_cjko | ( | str | s | ) |
This function check whether or not a string contains Chinese, Japanese, or Korean characters. It employs regex and uses the u escape sequence to match any character in a set of Unicode ranges. Args: s (str): string to be checked. Returns: bool: True if the input s contains the characters and False otherwise.
Definition at line 233 of file webutils.py.
Referenced by regex_highlight_cjk().
str searx.webutils.get_hash_for_file | ( | pathlib.Path | file | ) |
Definition at line 180 of file webutils.py.
Referenced by get_static_files().
str searx.webutils.get_json_response | ( | SearchQuery | sq, |
ResultContainer | rc ) |
Returns the JSON string of the results to a query (``application/json``)
Definition at line 159 of file webutils.py.
References get_translated_errors().
searx.webutils.get_result_templates | ( | templates_path | ) |
Definition at line 206 of file webutils.py.
Dict[str, str] searx.webutils.get_static_files | ( | str | static_path | ) |
Definition at line 187 of file webutils.py.
References get_hash_for_file().
searx.webutils.get_themes | ( | templates_path | ) |
Returns available themes list.
Definition at line 175 of file webutils.py.
searx.webutils.get_translated_errors | ( | Iterable[UnresponsiveEngine] | unresponsive_engines | ) |
Definition at line 69 of file webutils.py.
Referenced by get_json_response().
Groups an Iterable of engines by their first non tab category (first subgroup)
Definition at line 321 of file webutils.py.
searx.webutils.highlight_content | ( | content, | |
query ) |
Definition at line 275 of file webutils.py.
References regex_highlight_cjk().
searx.webutils.is_hmac_of | ( | secret_key, | |
value, | |||
hmac_to_check ) |
Definition at line 221 of file webutils.py.
References new_hmac().
searx.webutils.new_hmac | ( | secret_key, | |
url ) |
Definition at line 217 of file webutils.py.
Referenced by is_hmac_of().
searx.webutils.prettify_url | ( | url, | |
max_length = 74 ) |
Definition at line 226 of file webutils.py.
str searx.webutils.regex_highlight_cjk | ( | str | word | ) |
Generate the regex pattern to match for a given word according to whether or not the word contains CJK characters or not. If the word is and/or contains CJK character, the regex pattern will match standalone word by taking into account the presence of whitespace before and after it; if not, it will match any presence of the word throughout the text, ignoring the whitespace. Args: word (str): the word to be matched with regex pattern. Returns: str: the regex pattern for the word.
Definition at line 255 of file webutils.py.
References contains_cjko().
Referenced by highlight_content().
str searx.webutils.searxng_l10n_timespan | ( | datetime | dt | ) |
Returns a human-readable and translated string indicating how long ago a date was in the past / the time span of the date to the present. On January 1st, midnight, the returned string only indicates how many years ago the date was.
Definition at line 296 of file webutils.py.
None searx.webutils.write_csv_response | ( | CSVWriter | csv, |
ResultContainer | rc ) |
Write rows of the results to a query (``application/csv``) into a CSV table (:py:obj:`CSVWriter`). First line in the table contain the column names. The column "type" specifies the type, the following types are included in the table: - result - answer - suggestion - correction
Definition at line 112 of file webutils.py.
dict searx.webutils.exception_classname_to_text |
Definition at line 40 of file webutils.py.
searx.webutils.http_protocol_error_text = gettext('HTTP protocol error') |
Definition at line 37 of file webutils.py.
searx.webutils.logger = logger.getChild('webutils') |
Definition at line 33 of file webutils.py.
searx.webutils.network_error_text = gettext('network error') |
Definition at line 38 of file webutils.py.
str searx.webutils.NO_SUBGROUPING = 'without further subgrouping' |
Definition at line 318 of file webutils.py.
searx.webutils.parsing_error_text = gettext('parsing error') |
Definition at line 36 of file webutils.py.
searx.webutils.ssl_cert_error_text = gettext("SSL error: certificate validation has failed") |
Definition at line 39 of file webutils.py.
searx.webutils.timeout_text = gettext('timeout') |
Definition at line 35 of file webutils.py.
searx.webutils.VALID_LANGUAGE_CODE = re.compile(r'^[a-z]{2,3}(-[a-zA-Z]{2})?$') |
Definition at line 31 of file webutils.py.