From ca711d49dc8c82c9b1275c347c0dc8ab40a55057 Mon Sep 17 00:00:00 2001 From: Hugofvs Date: Mon, 7 Oct 2024 22:32:21 +0100 Subject: [PATCH] Fix repository credentials take priority over .netrc --- src/poetry/utils/authenticator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/poetry/utils/authenticator.py b/src/poetry/utils/authenticator.py index 47a03a7fd4b..dfb70d62c30 100644 --- a/src/poetry/utils/authenticator.py +++ b/src/poetry/utils/authenticator.py @@ -199,9 +199,10 @@ def request( credential = self.get_credentials_for_url(url) if credential.username is not None or credential.password is not None: - request = requests.auth.HTTPBasicAuth( + request.auth = requests.auth.HTTPBasicAuth( credential.username or "", credential.password or "" - )(request) + ) + request.auth(request) session = self.get_session(url=url) prepared_request = session.prepare_request(request)