From 90658a356dabb56b2747aee623a69688bf9b97e9 Mon Sep 17 00:00:00 2001 From: Marc Wrobel Date: Sun, 26 Nov 2023 15:31:12 +0100 Subject: [PATCH] Try to fix fetch_urls when ChunkedEncodingError occurs (#188) --- src/common/endoflife.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/endoflife.py b/src/common/endoflife.py index d8d1b808..19a10c98 100644 --- a/src/common/endoflife.py +++ b/src/common/endoflife.py @@ -66,8 +66,9 @@ def result_or_retry(future) -> Response: # Intermittent ChunkedEncodingErrors occurs while fetching URLs. This change try to fix it by retrying. # According to https://stackoverflow.com/a/44511691/374236, most servers transmit all data, but that's not # what was observed. - print(f"Got ChunkedEncodingError while fetching {e.request.url}, retrying...") - return fetch_urls([e.response.url], e.request.body, e.request.headers)[0] + url = e.response.url + print(f"Got ChunkedEncodingError while fetching {url}, retrying...") + return fetch_urls([url], e.request.body, e.request.headers)[0] def fetch_url(url, data=None, headers=None, max_retries=5, backoff_factor=0.5, timeout=30) -> str: