From 465351da65096d1561644d77000dfa0da35fd2bd Mon Sep 17 00:00:00 2001 From: Connor Quick Date: Thu, 9 Nov 2023 09:54:24 -0500 Subject: [PATCH] Only update session auth if provided in url --- src/proxpi/_cache.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/proxpi/_cache.py b/src/proxpi/_cache.py index ed63b35..812d824 100644 --- a/src/proxpi/_cache.py +++ b/src/proxpi/_cache.py @@ -446,7 +446,11 @@ def _list_files(self, package_name: str): if self._index_t is None or _now() > self._index_t + self.ttl: url = urllib.parse.urljoin(self.index_url, package_name) logger.debug(f"Refreshing '{package_name}'") - self.session.auth = _parse_basic_auth(url) + # update session auth if provided in url + username, password = _parse_basic_auth(url) + if username: + # password either supplied or empty str + self.session.auth = (username, password) response = self.session.get(url, headers=self._headers) if not response or not response.ok: logger.debug(f"List-files response: {response}")