Skip to content

Commit

Permalink
pypi: do not raise exception on 404
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed May 26, 2022
1 parent 99a8a45 commit 0c929c7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/poetry/repositories/pypi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,16 @@ def _get_release_info(

def _get(self, endpoint: str) -> dict[str, Any] | None:
try:
json_response = self.session.get(self._base_url + endpoint)
json_response = self.session.get(
self._base_url + endpoint, raise_for_status=True
)
except requests.exceptions.TooManyRedirects:
# Cache control redirect loop.
# We try to remove the cache and try again
self.session.delete_cache(self._base_url + endpoint)
json_response = self.session.get(self._base_url + endpoint)
json_response = self.session.get(
self._base_url + endpoint, raise_for_status=True
)

if json_response.status_code == 404:
return None
Expand Down

0 comments on commit 0c929c7

Please sign in to comment.