Skip to content

Commit 6814c26

Browse files
committed
Only update session auth if provided in url
1 parent 86e21c2 commit 6814c26

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/proxpi/_cache.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,11 @@ def _list_files(self, package_name: str):
446446
if self._index_t is None or _now() > self._index_t + self.ttl:
447447
url = urllib.parse.urljoin(self.index_url, package_name)
448448
logger.debug(f"Refreshing '{package_name}'")
449-
self.session.auth = _parse_basic_auth(url)
449+
# update session auth if provided in url
450+
username, password = _parse_basic_auth(url)
451+
if username:
452+
# password either supplied or empty str
453+
self.session.auth = (username, password)
450454
response = self.session.get(url, headers=self._headers)
451455
if not response or not response.ok:
452456
logger.debug(f"List-files response: {response}")

0 commit comments

Comments
 (0)