Revert "Fixed UnboundLocalError #571 (#580)" (#582)

This reverts commit 18e82b6625.
This commit is contained in:
Stéphane Bruckert 2020-10-06 08:01:52 +01:00 committed by GitHub
parent 18e82b6625
commit 76b640ae1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -7,10 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
### Fixed // Add your changes here and then delete this line
- UnboundLocalError when a request fails ( #571 )
## [2.16.0] - 2020-09-16 ## [2.16.0] - 2020-09-16

View File

@ -243,8 +243,7 @@ class Spotify(object):
response.raise_for_status() response.raise_for_status()
results = response.json() results = response.json()
except requests.exceptions.HTTPError as http_error: except requests.exceptions.HTTPError:
response = http_error.response
try: try:
msg = response.json()["error"]["message"] msg = response.json()["error"]["message"]
except (ValueError, KeyError): except (ValueError, KeyError):
@ -264,8 +263,7 @@ class Spotify(object):
reason=reason, reason=reason,
headers=response.headers, headers=response.headers,
) )
except requests.exceptions.RetryError as retry_error: except requests.exceptions.RetryError:
response = retry_error.response
logger.error('Max Retries reached') logger.error('Max Retries reached')
raise SpotifyException( raise SpotifyException(
599, 599,