.oO SearXNG Developer Documentation Oo.
|
Functions | |
get_locale () | |
_get_browser_language (req, lang_list) | |
_get_locale_rfc5646 (locale) | |
code_highlighter (codelines, language=None) | |
get_result_template (str theme_name, str template_name) | |
custom_url_for (str endpoint, **values) | |
image_proxify (str url) | |
get_translations () | |
get_enabled_categories (typing.Iterable[str] category_names) | |
get_pretty_url (urllib.parse.ParseResult parsed_url) | |
get_client_settings () | |
render (str template_name, **kwargs) | |
pre_request () | |
add_default_headers (flask.Response response) | |
post_request (flask.Response response) | |
index_error (str output_format, str error_message) | |
index () | |
health () | |
client_token (token=None) | |
rss_xsl () | |
search () | |
about () | |
info (pagename, locale) | |
autocompleter () | |
preferences () | |
image_proxy () | |
engine_descriptions () | |
stats () | |
stats_errors () | |
stats_checker () | |
stats_open_metrics () | |
robots () | |
opensearch () | |
favicon () | |
clear_cookies () | |
config () | |
page_not_found (_e) | |
run () | |
bool | is_werkzeug_reload_active () |
init () | |
Variables | |
logger = logger.getChild('webapp') | |
static_files = get_static_files(settings['ui']['static_path']) | |
default_theme = settings['ui']['default_theme'] | |
templates_path = settings['ui']['templates_path'] | |
themes = get_themes(templates_path) | |
result_templates = get_result_templates(templates_path) | |
dict | STATS_SORT_PARAMETERS |
app = Flask(__name__, static_folder=settings['ui']['static_path'], template_folder=templates_path) | |
trim_blocks | |
lstrip_blocks | |
secret_key | |
babel = Babel(app, locale_selector=get_locale) | |
methods | |
endpoint | |
view_func | |
application = app | |
WebbApp
|
protected |
Definition at line 170 of file webapp.py.
Referenced by pre_request().
|
protected |
Get locale name for <html lang="..."> Chrom* browsers don't detect the language when there is a subtag (ie a territory). For example "zh-TW" is detected but not "zh-Hant-TW". This function returns a locale without the subtag.
Definition at line 176 of file webapp.py.
Referenced by render().
searx.webapp.about | ( | ) |
Redirect to about page
Definition at line 756 of file webapp.py.
References custom_url_for().
searx.webapp.add_default_headers | ( | flask.Response | response | ) |
Definition at line 489 of file webapp.py.
searx.webapp.autocompleter | ( | ) |
Return autocompleter results
Definition at line 779 of file webapp.py.
searx.webapp.clear_cookies | ( | ) |
searx.webapp.client_token | ( | token = None | ) |
searx.webapp.code_highlighter | ( | codelines, | |
language = None ) |
Definition at line 188 of file webapp.py.
searx.webapp.config | ( | ) |
Return configuration in JSON format.
Definition at line 1241 of file webapp.py.
References searx.get_setting().
searx.webapp.custom_url_for | ( | str | endpoint, |
** | values ) |
Definition at line 242 of file webapp.py.
References searx.get_setting().
Referenced by about(), get_client_settings(), and render().
searx.webapp.engine_descriptions | ( | ) |
Definition at line 1062 of file webapp.py.
References get_locale().
searx.webapp.favicon | ( | ) |
Definition at line 1223 of file webapp.py.
searx.webapp.get_client_settings | ( | ) |
Definition at line 326 of file webapp.py.
References custom_url_for(), searx.get_setting(), and get_translations().
Referenced by render().
searx.webapp.get_enabled_categories | ( | typing.Iterable[str] | category_names | ) |
The categories in ``category_names```for which there is no active engine are filtered out and a reduced list is returned.
Definition at line 300 of file webapp.py.
Referenced by render().
searx.webapp.get_locale | ( | ) |
Definition at line 161 of file webapp.py.
Referenced by engine_descriptions().
searx.webapp.get_pretty_url | ( | urllib.parse.ParseResult | parsed_url | ) |
Definition at line 311 of file webapp.py.
searx.webapp.get_result_template | ( | str | theme_name, |
str | template_name ) |
searx.webapp.get_translations | ( | ) |
Definition at line 289 of file webapp.py.
Referenced by get_client_settings().
searx.webapp.health | ( | ) |
searx.webapp.image_proxify | ( | str | url | ) |
Definition at line 263 of file webapp.py.
searx.webapp.image_proxy | ( | ) |
Definition at line 989 of file webapp.py.
searx.webapp.index | ( | ) |
Render index page.
Definition at line 550 of file webapp.py.
References render().
searx.webapp.index_error | ( | str | output_format, |
str | error_message ) |
Definition at line 520 of file webapp.py.
References render().
Referenced by search().
searx.webapp.info | ( | pagename, | |
locale ) |
Render page of online user documentation
Definition at line 763 of file webapp.py.
References render().
searx.webapp.init | ( | ) |
Definition at line 1376 of file webapp.py.
References searx.get_setting(), searx.plugins.initialize(), searx.search.initialize(), and is_werkzeug_reload_active().
bool searx.webapp.is_werkzeug_reload_active | ( | ) |
Returns ``True`` if server is is launched by :ref:`werkzeug.serving` and the ``use_reload`` argument was set to ``True``. If this is the case, it should be avoided that the server is initialized twice (:py:obj:`init`, :py:obj:`run`). .. _werkzeug.serving: https://werkzeug.palletsprojects.com/en/stable/serving/#werkzeug.serving.run_simple
Definition at line 1344 of file webapp.py.
Referenced by init().
searx.webapp.opensearch | ( | ) |
Definition at line 1206 of file webapp.py.
References render().
searx.webapp.page_not_found | ( | _e | ) |
searx.webapp.post_request | ( | flask.Response | response | ) |
Definition at line 499 of file webapp.py.
searx.webapp.pre_request | ( | ) |
Definition at line 427 of file webapp.py.
References _get_browser_language().
searx.webapp.preferences | ( | ) |
Render preferences page && save user preferences
Definition at line 828 of file webapp.py.
References searx.get_setting(), and render().
searx.webapp.render | ( | str | template_name, |
** | kwargs ) |
Definition at line 348 of file webapp.py.
References _get_locale_rfc5646(), custom_url_for(), get_client_settings(), get_enabled_categories(), and searx.get_setting().
Referenced by index(), index_error(), info(), opensearch(), page_not_found(), preferences(), search(), and stats().
searx.webapp.robots | ( | ) |
Definition at line 1192 of file webapp.py.
searx.webapp.rss_xsl | ( | ) |
searx.webapp.run | ( | ) |
Runs the application on a local development server. This run method is only called when SearXNG is started via ``__main__``:: python -m searx.webapp Do not use :ref:`run() <flask.Flask.run>` in a production setting. It is not intended to meet security and performance requirements for a production server. It is not recommended to use this function for development with automatic reloading as this is badly supported. Instead you should be using the flask command line script’s run support:: flask --app searx.webapp run --debug --reload --host 127.0.0.1 --port 8888 .. _Flask.run: https://flask.palletsprojects.com/en/stable/api/#flask.Flask.run
Definition at line 1307 of file webapp.py.
References searx.get_setting().
searx.webapp.search | ( | ) |
Search query in q and return results. Supported outputs: html, json, csv, rss.
Definition at line 587 of file webapp.py.
References index_error(), and render().
searx.webapp.stats | ( | ) |
Render engine statistics page.
Definition at line 1088 of file webapp.py.
References render().
searx.webapp.stats_checker | ( | ) |
searx.webapp.stats_errors | ( | ) |
Definition at line 1155 of file webapp.py.
searx.webapp.stats_open_metrics | ( | ) |
Definition at line 1168 of file webapp.py.
searx.webapp.app = Flask(__name__, static_folder=settings['ui']['static_path'], template_folder=templates_path) |
searx.webapp.babel = Babel(app, locale_selector=get_locale) |
searx.webapp.default_theme = settings['ui']['default_theme'] |
searx.webapp.result_templates = get_result_templates(templates_path) |
searx.webapp.static_files = get_static_files(settings['ui']['static_path']) |
dict searx.webapp.STATS_SORT_PARAMETERS |
searx.webapp.templates_path = settings['ui']['templates_path'] |
searx.webapp.themes = get_themes(templates_path) |