Commit Graph

4215 Commits

Author SHA1 Message Date
Alexandre Flament 4a187d41be [fix] fix KeyError: 'ipv6'
tests/units/network/test_network.py requires a call to searx.network.network.initialize
Depending of the test order execution, this function was sometimes call in another test,
sometimes not.

This commit ensure there is a call to initialize()
2021-05-10 21:17:00 +02:00
Alexandre Flament 5e53e9412d [mod] searx.network.client: the same configuration reuses the same ssl.SSLContext
before there was one ssl.SSLContext per client.

see https://github.com/encode/httpx/issues/978
2021-05-06 22:52:30 +02:00
Noémi Ványi d93ac96c9f
Merge pull request #2800 from kvch/add-httpx
Replace requests with httpx to speed up searx
2021-05-03 22:11:31 +02:00
Alexandre Flament 75d1f38b20 [fix] searxng fix: sjp engine 2021-05-03 21:51:29 +02:00
Alexandre Flament 8d2ea790de [fix] searx.network: fix rare cases where LOOP is None
* searx.network.client.LOOP is initialized in a thread
* searx.network.__init__ imports LOOP which may happen
  before the thread has initialized LOOP

This commit adds a new function "searx.network.client.get_loop()"
to fix this issue
2021-05-03 21:47:04 +02:00
Markus Heiser e3b6757234 [fix] drop 'idna' from requirements.txt
Requirement idna was added in 181c12ae04 but I don't know why.  This package
is not directly used by searxng but its a sub-requirement of some other packages
using package `requests` (with different range of supported versions, see
below).  In summary one can say: the version of idna should be depend on package
`requests`::

    ...
    Pallets-Sphinx-Themes==1.2.3
      ...
      - Sphinx [required: Any, installed: 3.5.4]
        ...
        - requests [required: >=2.5.0, installed: 2.25.1]
	  ...
          - idna [required: >=2.5,<3, installed: 2.10]
        ...
    ...
    transifex-client==0.14.2
      - requests [required: >=2.19.1,<3.0.0, installed: 2.25.1]
        ...
        - idna [required: >=2.5,<3, installed: 2.10]
    twine==3.4.1
      ...
      - requests [required: >=2.20, installed: 2.25.1]
        ...
        - idna [required: >=2.5,<3, installed: 2.10]

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-05-03 21:43:11 +02:00
Markus Heiser 4c43290b7d [fix] debug log: UnicodeEncodeError: 'ascii' codec can't encode
The issue exists only in the debug log::

     --- Logging error ---
     Traceback (most recent call last):
       File "/usr/lib/python3.9/logging/__init__.py", line 1086, in emit
	 stream.write(msg + self.terminator)
     UnicodeEncodeError: 'ascii' codec can't encode characters in position 79-89: ordinal not in range(128)
     Call stack:
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 2464, in __call__
	 return self.wsgi_app(environ, start_response)
       File "/usr/local/searx/searx-src/searx/webapp.py", line 1316, in __call__
	 return self.app(environ, start_response)
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/werkzeug/middleware/proxy_fix.py", line 169, in __call__
	 return self.app(environ, start_response)
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
	 response = self.full_dispatch_request()
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
	 rv = self.dispatch_request()
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
	 return self.view_functions[rule.endpoint](**req.view_args)
       File "/usr/local/searx/searx-src/searx/webapp.py", line 766, in search
	 number_of_results=format_decimal(number_of_results),
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask_babel/__init__.py", line 458, in format_decimal
	 locale = get_locale()
       File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask_babel/__init__.py", line 226, in get_locale
	 rv = babel.locale_selector_func()
       File "/usr/local/searx/searx-src/searx/webapp.py", line 249, in get_locale
	 logger.debug("%s uses locale `%s` from %s", request.url, locale, locale_source)
     Unable to print the message and arguments - possible formatting error.
     Use the traceback above to help find the error.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-05-03 21:41:21 +02:00
Alexandre Flament 14fe1779b7 [httpx] replace searx.poolrequests by searx.network
settings.yml:

* outgoing.networks:
   * can contains network definition
   * propertiers: enable_http, verify, http2, max_connections, max_keepalive_connections,
     keepalive_expiry, local_addresses, support_ipv4, support_ipv6, proxies, max_redirects, retries
   * retries: 0 by default, number of times searx retries to send the HTTP request (using different IP & proxy each time)
   * local_addresses can be "192.168.0.1/24" (it supports IPv6)
   * support_ipv4 & support_ipv6: both True by default
     see https://github.com/searx/searx/pull/1034
* each engine can define a "network" section:
   * either a full network description
   * either reference an existing network

* all HTTP requests of engine use the same HTTP configuration (it was not the case before, see proxy configuration in master)
2021-05-03 21:39:54 +02:00
Alexandre Flament 88a96baedc [enh] replace requests by httpx 2021-05-03 21:39:37 +02:00
Alexandre Flament 4415d25485 [fix] test: avoid HTTP requests
patch engine initialization to skip HTTP request
(engine_init function in searx.engines.initialize_engines)
2021-05-03 21:39:24 +02:00
Adam Tauber f045c385d1
Merge pull request #2799 from MarcAbonce/fix_qwant_locales
Fix Qwant's fetch_languages function
2021-05-03 12:13:07 +02:00
Marc Abonce Seguin 3284132ae5 fix Qwant's fetch_languages function 2021-05-02 17:24:28 -07:00
Noémi Ványi 540959b524
Merge pull request #2790 from searx/dependabot/pip/master/pylint-2.8.2
Bump pylint from 2.7.4 to 2.8.2
2021-05-02 20:58:14 +02:00
dependabot[bot] 9c7090d4e6
Bump pylint from 2.7.4 to 2.8.2
Bumps [pylint](https://github.com/PyCQA/pylint) from 2.7.4 to 2.8.2.
- [Release notes](https://github.com/PyCQA/pylint/releases)
- [Changelog](https://github.com/PyCQA/pylint/blob/master/ChangeLog)
- [Commits](https://github.com/PyCQA/pylint/compare/pylint-2.7.4...v2.8.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-02 18:54:30 +00:00
Noémi Ványi 5d2b5d87a9 ignore new pylint warning in testing.py 2021-05-02 20:53:22 +02:00
Noémi Ványi 70c439aee5
Merge pull request #2797 from searx/update_data_update_ahmia_blacklist.py
Update searx.data - update_ahmia_blacklist.py
2021-05-02 20:41:49 +02:00
kvch 426ce34253 Update searx.data - update_ahmia_blacklist.py 2021-05-02 18:37:28 +00:00
kvch c06cfec774 Update searx.data - update_wikidata_units.py 2021-05-02 20:27:26 +02:00
kvch 065322e413 Update searx.data - update_currencies.py 2021-05-02 20:26:48 +02:00
Noémi Ványi 3574aa1070
Merge pull request #2796 from searx/update_data_update_firefox_version.py
Update searx.data - update_firefox_version.py
2021-05-02 20:26:16 +02:00
kvch 24326ee060 Update searx.data - update_firefox_version.py 2021-05-02 18:20:29 +00:00
Noémi Ványi e9a390f5d2 fix path to manage script in GH workflow 2021-05-02 20:08:37 +02:00
Noémi Ványi 58bcd685c3
Merge pull request #2789 from searx/dependabot/pip/master/babel-2.9.1
Bump babel from 2.9.0 to 2.9.1
2021-05-02 19:57:34 +02:00
dependabot[bot] 41b317cd3c
Bump babel from 2.9.0 to 2.9.1
Bumps [babel](https://github.com/python-babel/babel) from 2.9.0 to 2.9.1.
- [Release notes](https://github.com/python-babel/babel/releases)
- [Changelog](https://github.com/python-babel/babel/blob/master/CHANGES)
- [Commits](https://github.com/python-babel/babel/compare/v2.9.0...v2.9.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-30 06:15:59 +00:00
Pierre Chevalier 3a0f896b68 [enh] Add Springer Nature engine
Springer Nature is a global publisher dedicated to providing service to research
community [1] with official API [2].

To test this PR, first get your API key following this page:

   https://dev.springernature.com/signup

In searx/engines/springer.py at line 24, add this API key.  I left my own key,
commented out in the line aboce.  Feel free to use it, if needed.

[1] https://www.springernature.com/
[2] https://dev.springernature.com/
2021-04-29 22:43:52 +02:00
Noémi Ványi 839e5b1e9d Use oadoi.org as default_doi_resolver 2021-04-29 22:43:52 +02:00
spongebob33 6513a56064 add core.ac.uk engine 2021-04-29 22:43:52 +02:00
Noémi Ványi ff850f4961
Merge pull request #2706 from aurora-vasiliev/master
[enh] add DOI resolver from sci-hub
2021-04-29 22:20:50 +02:00
Noémi Ványi 7463250e76
Merge branch 'master' into master 2021-04-29 22:16:51 +02:00
Noémi Ványi dee75accf6 Fix remote PEP8 errors as well 2021-04-29 22:05:31 +02:00
Markus Heiser aa8288a963 [fix doc] manage.sh update_packages does not exists anymore
Reported-by: https://github.com/searx/searx/issues/2776
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-04-29 21:52:49 +02:00
Noémi Ványi 5cb29f6e46 Fix pep8 errors of database engines 2021-04-29 21:50:25 +02:00
3nprob fc4bf4bf10 Add hostname_replace plugin 2021-04-29 21:48:05 +02:00
Noémi Ványi c00a33feee Add MySQL engine 2021-04-29 21:41:58 +02:00
Noémi Ványi 22079ffdef Add PostgreSQL engine 2021-04-29 21:41:38 +02:00
Markus Heiser 34d7d97e1e [fix] youtube - send CONSENT Cookie to not be redirected
In the EU there exists a "General Data Protection Regulation" [1] aka GDPR (BTW:
very user friendly!) which requires consent to tracking.  To get the consent
from the user, youtube requests are redirected to confirm and get a CONSENT
Cookie from https://consent.youtube.com

This patch adds a CONSENT Cookie to the youtube request to avoid redirection.

[1] https://en.wikipedia.org/wiki/General_Data_Protection_Regulation

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Reported-by: https://github.com/searx/searx/issues/2774
2021-04-29 21:40:39 +02:00
Noémi Ványi f1058070f3
Merge pull request #2786 from mikeri/solidtorrents
Fix URL to solidtorrent result page
2021-04-29 21:29:59 +02:00
Noémi Ványi b8b7dcc3e1
Merge pull request #2716 from return42/fix-url-bar-suggestion
[fix] url bar autocomplete (opensearch suggestions)
2021-04-29 21:26:43 +02:00
Michael Ilsaas de0b735f3a Fix URL to solidtorrent result page 2021-04-28 23:57:54 +02:00
Adam Tauber 4828faaa07 [fix] exit on failure of creating environment to avoid endless loop in this case 2021-04-23 19:09:24 +02:00
Adam Tauber f7706a5c7f
Merge pull request #2594 from return42/manage-script
Replace Makefile boilerplate by shell scripts
2021-04-23 18:59:36 +02:00
Adam Tauber 28b3975aa8
Merge pull request #2760 from return42/fix-preference-save
[fix] redirect when saving preferences
2021-04-23 18:54:20 +02:00
Adam Tauber 4a85e6bec7
Merge pull request #2767 from searx/dependabot/pip/master/sphinx-3.5.4
Bump sphinx from 3.5.3 to 3.5.4
2021-04-21 18:12:23 +02:00
Adam Tauber a533fdc2bc
Merge pull request #2768 from Zackptg5/patch-1
Fix typo
2021-04-21 18:12:05 +02:00
Adam Tauber 2fa5f7af81
Merge pull request #2675 from dalf/oscar-images
[enh] oscar: image thumbnail layout
2021-04-21 15:31:12 +02:00
Zackptg5 a922b1c35f
Fix typo 2021-04-16 16:59:46 -04:00
Noémi Ványi 8362257b9a
Merge pull request #2736 from plague-doctor/sjp
Add new engine: SJP - Słownik języka polskiego
2021-04-16 17:30:14 +02:00
Noémi Ványi e56323d3c8
Merge pull request #2759 from ypid/fix/typo
Fix grammar mistake in debug log output
2021-04-16 17:26:45 +02:00
Noémi Ványi 312a51566c
Merge pull request #2764 from mikamp116/patch-1
Fix bug for 'FileNotFoundError' in 'standalone_searx.py'
2021-04-16 17:26:21 +02:00
Noémi Ványi 59df3bec28
Merge pull request #2763 from return42/add-bandcamp
Add Bandcamp search engine
2021-04-16 17:25:59 +02:00