Skip to content

Commit

Permalink
Merge pull request #327 from spiritualized/master
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed May 8, 2020
2 parents a040f42 + 6a28ba0 commit 2aaa594
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pylast/__init__.py
Expand Up @@ -932,7 +932,15 @@ def _download_response(self):
raise NetworkError(self.network, e)

try:
response_text = _unicode(conn.getresponse().read())
response = conn.getresponse()
if response.status in [500, 502, 503, 504]:
raise WSError(
self.network,
response.status,
"Connection to the API failed with HTTP code "
+ str(response.status),
)
response_text = _unicode(response.read())
except Exception as e:
raise MalformedResponseError(self.network, e)

Expand Down

0 comments on commit 2aaa594

Please sign in to comment.