From 95c39819ca9bb42a38fec04e41ea896755a367eb Mon Sep 17 00:00:00 2001 From: Tim Hatch Date: Mon, 26 Feb 2024 12:43:49 -0800 Subject: [PATCH] Allow initial HEAD to use redirects in lazy_wheel Fixes #9039 --- src/poetry/inspection/lazy_wheel.py | 2 +- src/poetry/utils/constants.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/poetry/inspection/lazy_wheel.py b/src/poetry/inspection/lazy_wheel.py index 54f566bb3c6..60d9d29b41a 100644 --- a/src/poetry/inspection/lazy_wheel.py +++ b/src/poetry/inspection/lazy_wheel.py @@ -383,7 +383,7 @@ def _content_length_from_head(self) -> int: :raises HTTPRangeRequestUnsupported: if the response fails to indicate support for "bytes" ranges.""" self._request_count += 1 - head = self._session.head(self._url, headers=self._uncached_headers()) + head = self._session.head(self._url, headers=self._uncached_headers(), allow_redirects=True) head.raise_for_status() assert head.status_code == codes.ok accepted_range = head.headers.get("Accept-Ranges", None) diff --git a/src/poetry/utils/constants.py b/src/poetry/utils/constants.py index e8fe2918e50..2d5e76196a3 100644 --- a/src/poetry/utils/constants.py +++ b/src/poetry/utils/constants.py @@ -9,4 +9,4 @@ RETRY_AFTER_HEADER = "retry-after" # Server response codes to retry requests on. -STATUS_FORCELIST = [429, 500, 501, 502, 503, 504] +STATUS_FORCELIST = [429, 500, 502, 503, 504]