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

Namespaces

namespace  answerers
 
namespace  autocomplete
 
namespace  babel_extract
 
namespace  botdetection
 
namespace  compat
 
namespace  data
 
namespace  enginelib
 
namespace  engines
 ::1337x
 
namespace  exceptions
 
namespace  external_bang
 
namespace  external_urls
 
namespace  favicons
 
namespace  flaskfix
 
namespace  infopage
 
namespace  limiter
 
namespace  locales
 
namespace  metrics
 
namespace  network
 
namespace  plugins
 
namespace  preferences
 
namespace  query
 
namespace  redisdb
 
namespace  redislib
 
namespace  results
 
namespace  search
 
namespace  settings_defaults
 
namespace  settings_loader
 
namespace  sqlitedb
 
namespace  sxng_locales
 
namespace  unixthreadname
 
namespace  utils
 
namespace  version
 
namespace  webadapter
 
namespace  webapp
 
namespace  webutils
 

Functions

 get_setting (name, default=_unset)
 
 is_color_terminal ()
 
 logging_config_debug ()
 

Variables

str LOG_FORMAT_DEBUG = '%(levelname)-7s %(name)-30.30s: %(message)s'
 
str LOG_FORMAT_PROD = '%(asctime)-15s %(levelname)s:%(name)s: %(message)s'
 
 LOG_LEVEL_PROD = logging.WARNING
 
 searx_dir = abspath(dirname(__file__))
 
 searx_parent_dir = abspath(dirname(dirname(__file__)))
 
 settings = settings_set_defaults(settings)
 
 settings_load_message
 
 _unset = object()
 
 searx_debug = settings['general']['debug']
 
 level
 
 format
 
 logger = logging.getLogger('searx')
 
 max_request_timeout = settings['outgoing']['max_request_timeout']
 

Function Documentation

◆ get_setting()

searx.get_setting ( name,
default = _unset )
Returns the value to which ``name`` point.  If there is no such name in the
settings and the ``default`` is unset, a :py:obj:`KeyError` is raised.

Definition at line 32 of file __init__.py.

32def get_setting(name, default=_unset):
33 """Returns the value to which ``name`` point. If there is no such name in the
34 settings and the ``default`` is unset, a :py:obj:`KeyError` is raised.
35
36 """
37 value = settings
38 for a in name.split('.'):
39 if isinstance(value, dict):
40 value = value.get(a, _unset)
41 else:
42 value = _unset
43
44 if value is _unset:
45 if default is _unset:
46 raise KeyError(name)
47 value = default
48 break
49
50 return value
51
52

◆ is_color_terminal()

searx.is_color_terminal ( )

Definition at line 53 of file __init__.py.

53def is_color_terminal():
54 if os.getenv('TERM') in ('dumb', 'unknown'):
55 return False
56 return sys.stdout.isatty()
57
58

Referenced by logging_config_debug().

+ Here is the caller graph for this function:

◆ logging_config_debug()

searx.logging_config_debug ( )

Definition at line 59 of file __init__.py.

59def logging_config_debug():
60 try:
61 import coloredlogs # pylint: disable=import-outside-toplevel
62 except ImportError:
63 coloredlogs = None
64
65 log_level = os.environ.get('SEARXNG_DEBUG_LOG_LEVEL', 'DEBUG')
66 if coloredlogs and is_color_terminal():
67 level_styles = {
68 'spam': {'color': 'green', 'faint': True},
69 'debug': {},
70 'notice': {'color': 'magenta'},
71 'success': {'bold': True, 'color': 'green'},
72 'info': {'bold': True, 'color': 'cyan'},
73 'warning': {'color': 'yellow'},
74 'error': {'color': 'red'},
75 'critical': {'bold': True, 'color': 'red'},
76 }
77 field_styles = {
78 'asctime': {'color': 'green'},
79 'hostname': {'color': 'magenta'},
80 'levelname': {'color': 8},
81 'name': {'color': 8},
82 'programname': {'color': 'cyan'},
83 'username': {'color': 'yellow'},
84 }
85 coloredlogs.install(level=log_level, level_styles=level_styles, field_styles=field_styles, fmt=LOG_FORMAT_DEBUG)
86 else:
87 logging.basicConfig(level=logging.getLevelName(log_level), format=LOG_FORMAT_DEBUG)
88
89

References is_color_terminal().

+ Here is the call graph for this function:

Variable Documentation

◆ _unset

searx._unset = object()
protected

Definition at line 29 of file __init__.py.

◆ format

searx.format

Definition at line 94 of file __init__.py.

Referenced by searx.preferences.EnginesSetting.__init__(), searx.metrics.error_recorder.ErrorContext.__repr__(), searx.search.models.EngineRef.__repr__(), searx.search.models.SearchQuery.__repr__(), searx.search.checker.impl.ResultContainerTests._record_error(), searx.search.processors.online.OnlineProcessor._send_http_request(), searx.preferences.EnumStringSetting._validate_selection(), searx.preferences.SearchLanguageSetting._validate_selection(), searx.preferences.MultipleChoiceSetting._validate_selections(), searx.engines.duckduckgo_definitions.area_to_str(), searx.webapp.custom_url_for(), searx.favicons.proxy.FaviconProxyConfig.favicon(), searx.engines.qwant.fetch_traits(), searx.utils.gen_useragent(), searx.engines.torznab.get_torznab_attribute(), searx.query.RawTextQuery.getFullQuery(), searx.webapp.image_proxify(), searx.engines.is_missing_required_attributes(), searx.engines.load_engine(), searx.plugins.load_plugin(), searx.webapp.morty_proxify(), searx.utils.normalize_url(), searx.preferences.MapSetting.parse(), searx.flaskfix.patch_application(), searx.plugins.tor_check.post_search(), searx.plugins.prepare_package_resources(), searx.webutils.prettify_url(), searx.engines.register_engine(), searx.webapp.render(), searx.engines.invidious.request(), searx.engines.mediawiki.request(), searx.engines.spotify.request(), searx.engines.bing_videos.response(), searx.engines.currency_convert.response(), searx.engines.deezer.response(), searx.engines.flickr_noapi.response(), searx.engines.pdbe.response(), searx.engines.recoll.response(), searx.engines.semantic_scholar.response(), searx.engines.spotify.response(), searx.engines.translated.response(), searx.preferences.BooleanChoices.save(), searx.engines.mongodb.search(), searx.engines.redis_server.search(), searx.search.processors.online.OnlineProcessor.search(), searx.webapp.search(), searx.engines.redis_server.search_keys(), searx.utils.searx_useragent(), searx.webutils.searxng_l10n_timespan(), searx.answerers.random.answerer.self_info(), searx.answerers.statistics.answerer.self_info(), searx.plugins.sync_resource(), and searx.engines.openstreetmap.value_wikipedia_link().

◆ level

searx.level

Definition at line 94 of file __init__.py.

◆ LOG_FORMAT_DEBUG

str searx.LOG_FORMAT_DEBUG = '%(levelname)-7s %(name)-30.30s: %(message)s'

Definition at line 16 of file __init__.py.

◆ LOG_FORMAT_PROD

str searx.LOG_FORMAT_PROD = '%(asctime)-15s %(levelname)s:%(name)s: %(message)s'

Definition at line 19 of file __init__.py.

◆ LOG_LEVEL_PROD

searx.LOG_LEVEL_PROD = logging.WARNING

Definition at line 20 of file __init__.py.

◆ logger

searx.logger = logging.getLogger('searx')

Definition at line 97 of file __init__.py.

◆ max_request_timeout

searx.max_request_timeout = settings['outgoing']['max_request_timeout']

Definition at line 101 of file __init__.py.

◆ searx_debug

searx.searx_debug = settings['general']['debug']

Definition at line 90 of file __init__.py.

◆ searx_dir

searx.searx_dir = abspath(dirname(__file__))

Definition at line 22 of file __init__.py.

◆ searx_parent_dir

searx.searx_parent_dir = abspath(dirname(dirname(__file__)))

Definition at line 23 of file __init__.py.

◆ settings

searx.settings = settings_set_defaults(settings)

Definition at line 24 of file __init__.py.

◆ settings_load_message

searx.settings_load_message

Definition at line 24 of file __init__.py.