acousticbrainz: Handle requests errors

This commit is contained in:
Adrian Sampson 2015-12-31 11:29:57 -08:00
parent eb2b081dfd
commit 18e5b30d19

View file

@ -48,10 +48,16 @@ def fetch_info(log, lib):
if item.mb_trackid:
log.info('getting data for: {}', item)
# Fetch the data from the AB API.
url = generate_url(item.mb_trackid)
log.debug('fetching URL: {}', url)
rs = requests.get(url)
try:
rs = requests.get(url)
except requests.RequestException as exc:
log.info('request error: {}', exc)
continue
# Parse the JSON response.
try:
rs.json()
except ValueError: