requests_cache compatibility

This commit is contained in:
Tim Jagenberg 2019-07-27 22:26:28 +02:00
parent 4c2c1d763a
commit 2252ea5cfa

View File

@ -128,6 +128,7 @@ class Spotify(object):
raise SpotifyException(r.status_code, raise SpotifyException(r.status_code,
-1, '%s:\n %s' % (r.url, 'error'), headers=r.headers) -1, '%s:\n %s' % (r.url, 'error'), headers=r.headers)
finally: finally:
if hasattr(r, "connection"):
r.connection.close() r.connection.close()
if r.text and len(r.text) > 0 and r.text != 'null': if r.text and len(r.text) > 0 and r.text != 'null':
results = r.json() results = r.json()