spotipy/spotipy/exceptions.py

17 lines
501 B
Python

class SpotifyException(Exception):
def __init__(self, http_status, code, msg, headers=None):
self.http_status = http_status
self.code = code
self.msg = msg
# `headers` is used to support `Retry-After` in the event of a
# 429 status code.
if headers is None:
headers = {}
self.headers = headers
def __str__(self):
return 'http status: {0}, code:{1} - {2}'.format(
self.http_status, self.code, self.msg)