summaryrefslogtreecommitdiff
path: root/searx/utils.py
Commit message (Collapse)AuthorAge
* [mod] searx.utils: more typingAlexandre Flament2022-01-30
|
* [mod] add documentation about searx.utilsAlexandre Flament2022-01-29
| | | | | | | This module is a toolbox for the engines. Is should be documented. In addition, searx/utils.py is checked by pylint.
* [format.python] initial formatting of the python codeMarkus Heiser2021-12-27
| | | | | | | | | | This patch was generated by black [1]:: make format.python [1] https://github.com/psf/black Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
* [fix] fix match_language issue to make zh-TW match to zh-Hant-TWMarc Abonce Seguin2021-10-12
| | | | | pybabel separates locales with underscores but we use hyphens everywhere babel doesn't directly touch
* [fix] don't mix loaded modules with imported modules (sys.modules)Markus Heiser2021-10-06
| | | | | | | | | | | | The utils.load_module() function is used to load a python file (aka module) and return the module's namespace. SearXNG uses this function to load *engines and answerers* from arbitrary locations with arbitrary modifications. These are not real python modules and it is not intended to mix this *engines and answerers* with the python modules registered in sys.modules. Closes: https://github.com/searxng/searxng/issues/312 Suggested-by: @dalf in https://github.com/searxng/searxng/issues/312 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
* [mod] searx.utils.dict_subset: rewrite with comprehensionAlexandre Flament2021-08-24
|
* version based on the git repositoryAlexandre Flament2021-07-30
| | | | | | | | This commit remove the need to update the brand for GIT_URL and GIT_BRANCH: there are read from the git repository. It is possible to call python -m searx.version freeze to freeze the current version. Useful when the code is installed outside git (distro package, docker, etc...)
* [fix] strip spaces from searx user agentAlexandre Flament2021-06-09
| | | | h11 (used by httpx) rejects HTTP request with a trailing space in HTTP headers
* [mod] move all default settings into searx.settings_defaultsAlexandre Flament2021-06-01
|
* [mod] utils.get_value() - avoidance of a recursionMarkus Heiser2021-05-28
| | | | | | | | | In a comment [1] dalf suggested to avoid a recursion of get_value() [1] https://github.com/searxng/searxng/pull/99#discussion_r640833716 Suggested-by: Alexandre Flament <alex@al-f.net> Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
* [enh] add settings option to enable/disable search formatsMarkus Heiser2021-05-28
| | | | | | | | | | Access to formats can be denied by settings configuration:: search: formats: [html, csv, json, rss] Closes: https://github.com/searxng/searxng/issues/95 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
* [enh] replace requests by httpxAlexandre Flament2021-04-10
|
* [fix] pylint: use "raise ... from ..."Alexandre Flament2020-12-20
|
* [mod] bing_news: use eval_xpath_getindexAlexandre Flament2020-12-03
| | | | remove unused function searx.utils.list_get
* [enh] record details exception per engineAlexandre Flament2020-12-03
| | | | add an new API /stats/errors
* [mod] pylint: numerous minor code fixesAlexandre Flament2020-12-01
|
* [mod] remove unused importAlexandre Flament2020-11-14
| | | | | | | use from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA so it is possible to easily remove all unused import using autoflake: autoflake --in-place --recursive --remove-all-unused-imports searx tests
* [mod] duckduckgo_definitions: display only user friendly attributes / URLAlexandre Flament2020-10-28
| | | | various bug fixes
* [mod] Add searx.data moduleAlexandre Flament2020-10-07
| | | | | Instead of loading the data/*.json in different location, load these files in the new searx.data module.
* [fix] drop Python 2: use importlib instead of imp.load_sourceAlexandre Flament2020-10-06
| | | | | | | imp.load_source is not documented in Python 3 see documentation : https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly partial fix of https://github.com/searx/searx/issues/1674
* [mod] searx.utils.normalize_url: remove Yahoo hackAlexandre Flament2020-10-03
| | | | | * The hack for Yahoo URLs is not necessary anymore. (see searx.engines.yahoo.parse_url) * move the URL normalization in extract_url to normalize_url
* [mod] searx/utils.py: add docstringAlexandre Flament2020-10-02
|
* [mod] move extract_text, extract_url to searx.utilsAlexandre Flament2020-10-02
|
* [mod] add searx/webutils.pyAlexandre Flament2020-09-22
| | | | contains utility functions and classes used only by webapp.py
* [fix] searx.utils.HTMLTextExtractor: invalid HTML don't raise an ExceptionAlexandre Flament2020-09-13
| | | | Close #2188
* Drop Python 2 (5/n): searx.utils.is_valid_lang, input parameter is a str ↵Alexandre Flament2020-09-10
| | | | | | instead of bytes Fix bug in translated.py and dictzone.py
* Drop Python 2 (4/n): SearchQuery.query is a str instead of bytesDalf2020-09-10
|
* Drop Python 2 (1/n): remove unicode string and url_utilsDalf2020-09-10
|
* [mod] speed optimizationDalf2019-11-15
| | | | | | compile XPath only once avoid redundant call to urlparse get_locale(webapp.py): avoid useless call to request.accept_languages.best_match
* fix pep 8 checkNoémi Ványi2019-10-16
|
* add initial support for offline engines && command engineNoémi Ványi2019-10-16
|
* [fix] convert bytes type to string in language detection (fixes dictzone)Adam Tauber2019-10-16
|
* [fix] fix flickr_noapi decoding (#1655)Alexandre Flament2019-08-02
| | | | | Characters that were not ASCII were incorrectly decoded. Add an helper function: searx.utils.ecma_unescape (Python implementation of unescape Javascript function).
* [mod] use cache in _match_language function to speed up searx start time ↵Dalf2019-07-19
| | | | significantly
* [fix] secret_key can be bytes instead of a string (#1602)rachmadani haryono2019-07-17
| | | | Fix #1600 In settings.yml, the secret_key can be written as string or as base64 encoded data using !!binary notation.
* fetch_firefox_version.py : compatible with Python 3 and minor fixes.Alex2018-08-05
|
* [mod] fetch firefox versions in a standalone scriptAlexandre Flament2018-08-05
|
* Merge pull request #1303 from MarcAbonce/bingAdam Tauber2018-07-09
|\ | | | | Fix bing "garbage" results
| * fix bing "garbage" results (issue #1275)Marc Abonce Seguin2018-05-20
| |
* | [fix] update user agent versionsMarc Abonce Seguin2018-06-23
| | | | | | | | this fixes duckduckgo error response
* | [fix] add basestring for py3Adam Tauber2018-06-14
|/
* refactor engine's search language handlingMarc Abonce Seguin2018-03-27
| | | | | | | | Add match_language function in utils to match any user given language code with a list of engine's supported languages. Also add language_aliases dict on each engine to translate standard language codes into the custom codes used by the engine.
* [fix] convert json engine result attributes to string - closes #1006Adam Tauber2017-12-01
|
* [fix] remove trailing 0x00 from csv outputAdam Tauber2017-11-21
|
* [fix] resurrect csv output in py2Adam Tauber2017-11-21
|
* fix hmac python3 compatibilityNoémi Ványi2017-09-08
|
* [mod] int_or_zero refactored to searx_utilsmisnyo2017-09-04
|
* [fix] is_valid_lang fixed for new languages.py + dictzone engine encodingpotato2017-06-25
|
* [mod] settings.yml can be /etc/searx/settings.ymlAlexandre Flament2017-05-15
| | | | | | | | The exact order is * first from SEARX_SETTINGS_PATH, * if not found then from searx code base, * if not found then from /etc/searx/settings.yml * if not found an exception stops searx loading
* [mod] the static and templates directories can be defined in the settings.ymlAlexandre Flament2017-05-15
|