diff --git a/src/poetry/utils/helpers.py b/src/poetry/utils/helpers.py index fbc29e5b4dd..221c94d3426 100644 --- a/src/poetry/utils/helpers.py +++ b/src/poetry/utils/helpers.py @@ -20,10 +20,9 @@ from typing import Any from typing import overload -import requests - from requests.utils import atomic_open +from poetry.utils.authenticator import Authenticator from poetry.utils.constants import REQUESTS_TIMEOUT @@ -35,8 +34,6 @@ from poetry.core.packages.package import Package from requests import Session - from poetry.utils.authenticator import Authenticator - logger = logging.getLogger(__name__) prioritised_hash_types: tuple[str, ...] = tuple( t @@ -171,10 +168,10 @@ def __init__( ): self._dest = dest - get = requests.get if not session else session.get + session = session or Authenticator() headers = {"Accept-Encoding": "Identity"} - self._response = get( + self._response = session.get( url, stream=True, headers=headers, timeout=REQUESTS_TIMEOUT ) self._response.raise_for_status()