From ca65ce11f2341109972a39965df62a0b25ea01b1 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 21 Jun 2023 11:35:43 -0400 Subject: [PATCH] Still need to bail on bad responses --- vrobbler/apps/music/theaudiodb.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vrobbler/apps/music/theaudiodb.py b/vrobbler/apps/music/theaudiodb.py index c41a03b..3163ca3 100644 --- a/vrobbler/apps/music/theaudiodb.py +++ b/vrobbler/apps/music/theaudiodb.py @@ -35,6 +35,14 @@ def lookup_artist_from_tadb(name_or_id: str) -> dict: # Try using an TABD ID response = requests.get(ARTIST_FETCH_URL + name_or_id) + if response.status_code != 200: + logger.warn(f"Bad response from TADB: {response.status_code}") + return artist_info + + if not response.content: + logger.warn(f"Bad content from TADB: {response.content}") + return artist_info + results = json.loads(response.content) if results["artists"]: artist = results["artists"][0]