.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.data Namespace Reference

Namespaces

namespace  core
namespace  currencies
namespace  tracker_patterns

Classes

class  LocalesType
class  UserAgentType
class  WikiDataUnitType

Functions

t.Any __getattr__ (str name)
list[str] ahmia_blacklist_loader ()

Variables

list __all__ = ["ahmia_blacklist_loader", "data_dir", "get_cache"]
dict lazy_globals
dict data_json_files

Detailed Description

This module holds the *data* created by::

  make data.all

Function Documentation

◆ __getattr__()

t.Any searx.data.__getattr__ ( str name)

Definition at line 80 of file __init__.py.

80def __getattr__(name: str) -> t.Any:
81 # lazy init of the global objects
82 if name not in lazy_globals:
83 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
84
85 data = lazy_globals[name]
86 if data is not None:
87 return data
88
89 log.debug("init searx.data.%s", name)
90
91 with open(data_dir / data_json_files[name], encoding='utf-8') as f:
92 lazy_globals[name] = json.load(f)
93
94 return lazy_globals[name]
95
96

◆ ahmia_blacklist_loader()

list[str] searx.data.ahmia_blacklist_loader ( )
Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion
names.  The MD5 values are fetched by::

  searxng_extra/update/update_ahmia_blacklist.py

This function is used by :py:mod:`searx.plugins.ahmia_filter`.

Definition at line 97 of file __init__.py.

97def ahmia_blacklist_loader() -> list[str]:
98 """Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion
99 names. The MD5 values are fetched by::
100
101 searxng_extra/update/update_ahmia_blacklist.py
102
103 This function is used by :py:mod:`searx.plugins.ahmia_filter`.
104
105 """
106 with open(data_dir / 'ahmia_blacklist.txt', encoding='utf-8') as f:
107 return f.read().split()

Variable Documentation

◆ __all__

list searx.data.__all__ = ["ahmia_blacklist_loader", "data_dir", "get_cache"]
private

Definition at line 9 of file __init__.py.

◆ data_json_files

dict searx.data.data_json_files
Initial value:
1= {
2 "USER_AGENTS": "useragents.json",
3 "EXTERNAL_URLS": "external_urls.json",
4 "WIKIDATA_UNITS": "wikidata_units.json",
5 "EXTERNAL_BANGS": "external_bangs.json",
6 "OSM_KEYS_TAGS": "osm_keys_tags.json",
7 "ENGINE_DESCRIPTIONS": "engine_descriptions.json",
8 "ENGINE_TRAITS": "engine_traits.json",
9 "LOCALES": "locales.json",
10}

Definition at line 68 of file __init__.py.

◆ lazy_globals

dict searx.data.lazy_globals
Initial value:
1= {
2 "CURRENCIES": CurrenciesDB(),
3 "USER_AGENTS": None,
4 "EXTERNAL_URLS": None,
5 "WIKIDATA_UNITS": None,
6 "EXTERNAL_BANGS": None,
7 "OSM_KEYS_TAGS": None,
8 "ENGINE_DESCRIPTIONS": None,
9 "ENGINE_TRAITS": None,
10 "LOCALES": None,
11 "TRACKER_PATTERNS": TrackerPatternsDB(),
12}

Definition at line 55 of file __init__.py.