Improve failure behaviour when unable to refresh cache
This commit is contained in:
parent
66c39629fc
commit
ad61f30a4c
@ -36,13 +36,12 @@ def do_request(endpoint, args=None, cachetime=3600):
|
||||
try:
|
||||
resp = urlopen(req)
|
||||
except Exception as ex:
|
||||
if url in request_cache:
|
||||
print('Unable to refresh cache')
|
||||
traceback.print_exc()
|
||||
|
||||
if url in request_cache:
|
||||
return request_cache[url][1]
|
||||
else:
|
||||
return None
|
||||
raise ex
|
||||
data = json.load(resp)
|
||||
|
||||
# Cache the response
|
||||
|
Reference in New Issue
Block a user