mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 03:54:21 +01:00
lyrics: Handle requests exceptions (#1136)
This commit is contained in:
parent
7ff956d492
commit
165ee80f81
1 changed files with 5 additions and 2 deletions
|
|
@ -61,12 +61,15 @@ def fetch_url(url):
|
|||
"""Retrieve the content at a given URL, or return None if the source
|
||||
is unreachable.
|
||||
"""
|
||||
r = requests.get(url)
|
||||
try:
|
||||
r = requests.get(url)
|
||||
except requests.RequestException as exc:
|
||||
log.debug(u'lyrics request failed: {0}'.format(exc))
|
||||
return
|
||||
if r.status_code == requests.codes.ok:
|
||||
return r.text
|
||||
else:
|
||||
log.debug(u'failed to fetch: {0} ({1})'.format(url, r.status_code))
|
||||
return None
|
||||
|
||||
|
||||
def unescape(text):
|
||||
|
|
|
|||
Loading…
Reference in a new issue