[fix] checker: fix image fetch

Since https://github.com/searxng/searxng/pull/354
the searx.network.stream(...) returns a tuple

This commits update the checker code according to
this function signature change.
dependabot/pip/master/sphinx-6.1.3
Alexandre Flament 2 years ago
parent f3d4b25e73
commit 5439dd5fb1

@ -74,7 +74,7 @@ def _download_and_check_if_image(image_url: str) -> bool:
try:
# use "image_proxy" (avoid HTTP/2)
network.set_context_network_name('image_proxy')
stream = network.stream(
r, stream = network.stream(
'GET',
image_url,
timeout=10.0,
@ -91,7 +91,6 @@ def _download_and_check_if_image(image_url: str) -> bool:
'Cache-Control': 'max-age=0',
},
)
r = next(stream)
r.close()
if r.status_code == 200:
is_image = r.headers.get('content-type', '').startswith('image/')

Loading…
Cancel
Save