Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
Fix #251: Internal Server Error when package in local storage but not…
Browse files Browse the repository at this point in the history
… in fallback repository
  • Loading branch information
stevearc committed Jul 14, 2020
1 parent d880169 commit 466fbbd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pypicloud/locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SimpleJsonLocator(object):

def __init__(self, base_index):
self.base_index = base_index
# 10m cache
# 16m cache
self._cache = TimedCache(1000, self._get_releases)

def get_releases(self, project_name):
Expand All @@ -21,6 +21,9 @@ def get_releases(self, project_name):
def _get_releases(self, project_name):
url = "%s/pypi/%s/json" % (self.base_index, project_name)
response = requests.get(url)
# Return empty list for 4xx
if 400 <= response.status_code < 500:
return []
response.raise_for_status()
data = response.json()
items = []
Expand Down

0 comments on commit 466fbbd

Please sign in to comment.