diff options
| -rw-r--r-- | .github/workflows/integration.yml | 2 | ||||
| -rw-r--r-- | docs/conf.py | 8 | ||||
| -rw-r--r-- | searx/network/__init__.py | 15 | ||||
| -rw-r--r-- | searx/results.py | 3 |
4 files changed, 19 insertions, 9 deletions
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 84ce51a04..85b225a5a 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10.0-rc.2"] steps: - name: Checkout uses: actions/checkout@v2 diff --git a/docs/conf.py b/docs/conf.py index 978d6a660..160063ceb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -9,9 +9,9 @@ from searx.version import VERSION_STRING, GIT_URL, GIT_BRANCH # Project -------------------------------------------------------------- -project = u'searx' -copyright = u'2015-2020, Adam Tauber, Noémi Ványi' -author = u'Adam Tauber' +project = 'SearXNG' +copyright = '2021 SearXNG team, 2015-2021 Adam Tauber, Noémi Ványi' +author = '2021 SearXNG team, 2015-2021 Adam Tauber' release, version = VERSION_STRING, VERSION_STRING SEARX_URL = get_setting('server.base_url') or 'https://example.org/searx' @@ -132,7 +132,7 @@ html_sidebars = { singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]} html_static_path = ["static"] html_logo = "static/img/searx_logo_small.png" -html_title = "Searx Documentation ({})".format("Searx-{}.tex".format(VERSION_STRING)) +html_title = "Searx Documentation ({})".format(VERSION_STRING) html_show_sourcelink = False # LaTeX ---------------------------------------------------------------- diff --git a/searx/network/__init__.py b/searx/network/__init__.py index 7b0396a12..21c4c27b5 100644 --- a/searx/network/__init__.py +++ b/searx/network/__init__.py @@ -173,9 +173,17 @@ async def stream_chunk_to_queue(network, queue, method, url, **kwargs): if len(chunk) > 0: queue.put(chunk) except httpx.ResponseClosed: - # the response was closed + # the response was queued before the exception. + # the exception was raised on aiter_raw. + # we do nothing here: in the finally block, None will be queued + # so stream(method, url, **kwargs) generator can stop pass - except (httpx.HTTPError, OSError, h2.exceptions.ProtocolError) as e: + except Exception as e: # pylint: disable=broad-except + # broad except to avoid this scenario: + # exception in network.stream(method, url, **kwargs) + # -> the exception is not catch here + # -> queue None (in finally) + # -> the function below steam(method, url, **kwargs) has nothing to return queue.put(e) finally: queue.put(None) @@ -201,8 +209,9 @@ def stream(method, url, **kwargs): the httpx.AsyncHTTPTransport declared above. """ queue = SimpleQueue() + network = get_context_network() future = asyncio.run_coroutine_threadsafe( - stream_chunk_to_queue(get_network(), queue, method, url, **kwargs), + stream_chunk_to_queue(network, queue, method, url, **kwargs), get_loop() ) diff --git a/searx/results.py b/searx/results.py index ae8cf2498..2e81f5dc4 100644 --- a/searx/results.py +++ b/searx/results.py @@ -255,7 +255,8 @@ class ResultContainer: result['url'] = result['parsed_url'].geturl() # strip multiple spaces and cariage returns from content - result['content'] = WHITESPACE_REGEX.sub(' ', result['content']) + if result.get('content'): + result['content'] = WHITESPACE_REGEX.sub(' ', result['content']) return True |