summaryrefslogtreecommitdiff
path: root/searx/network
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-09-28 17:44:00 +0200
committerAlexandre Flament <alex@al-f.net>2021-09-28 19:33:29 +0200
commita9c3c88cc0edf4dc3183f2188c518ec4a5b37055 (patch)
treec7bbf4817ecaab06f24ecfd6d6b6cb19c2454da7 /searx/network
parentc23aa5760cb42003c1372ccdef1611695504eb9e (diff)
downloadsearxng-a9c3c88cc0edf4dc3183f2188c518ec4a5b37055.tar.gz
searxng-a9c3c88cc0edf4dc3183f2188c518ec4a5b37055.zip
[mod] searx.network.stream returns a tuple (response, stream)
Diffstat (limited to 'searx/network')
-rw-r--r--searx/network/__init__.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/searx/network/__init__.py b/searx/network/__init__.py
index 37df0c85a..496fd2fbf 100644
--- a/searx/network/__init__.py
+++ b/searx/network/__init__.py
@@ -219,8 +219,7 @@ def stream(method, url, **kwargs):
"""Replace httpx.stream.
Usage:
- stream = poolrequests.stream(...)
- response = next(stream)
+ response, stream = poolrequests.stream(...)
for chunk in stream:
...
@@ -236,6 +235,5 @@ def stream(method, url, **kwargs):
response._generator = generator # pylint: disable=protected-access
response.close = MethodType(_close_response_method, response)
- yield response
- yield from generator
+ return response, generator