Skip to content

Commit

Permalink
Only update session auth if provided in url
Browse files Browse the repository at this point in the history
  • Loading branch information
cquick01 committed Nov 9, 2023
1 parent 86e21c2 commit 6814c26
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/proxpi/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 6814c26

Please sign in to comment.