Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Commit 1100b43

Browse files
committed
adjust check_response
1 parent 3b44f07 commit 1100b43

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spotify_web_downloader/spotify_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ class SpotifyApi:
2828
)
2929
METADATA_API_URL = "https://api.spotify.com/v1/{type}/{track_id}"
3030
PATHFINDER_API_URL = "https://api-partner.spotify.com/pathfinder/v1/query"
31-
TRACK_CREDITS_API_URL = (
32-
"https://spclient.wg.spotify.com/track-credits-view/v0/experimental/{track_id}/credits"
33-
)
31+
TRACK_CREDITS_API_URL = "https://spclient.wg.spotify.com/track-credits-view/v0/experimental/{track_id}/credits"
3432
EXTEND_TRACK_COLLECTION_WAIT_TIME = 0.5
3533

3634
def __init__(
@@ -70,7 +68,9 @@ def _setup_session(self):
7068

7169
@staticmethod
7270
def _check_response(response: requests.Response):
73-
if not response.ok:
71+
try:
72+
response.raise_for_status()
73+
except requests.HTTPError:
7474
raise Exception(
7575
f"Request failed with status code {response.status_code}: {response.text}"
7676
)

0 commit comments

Comments
 (0)