Add exception for 4xx error codes (closes #136)
This commit is contained in:
parent
5ce1f4bd50
commit
302c95ff6f
1 changed files with 3 additions and 0 deletions
|
|
@ -109,6 +109,9 @@ class YTMusic(BrowsingMixin, WatchMixin, LibraryMixin, PlaylistsMixin, UploadsMi
|
||||||
json=body,
|
json=body,
|
||||||
headers=self.headers,
|
headers=self.headers,
|
||||||
proxies=self.proxies)
|
proxies=self.proxies)
|
||||||
|
if response.status_code >= 400:
|
||||||
|
raise Exception("Error: Server returned HTTP " + str(response.status_code) +
|
||||||
|
": " + response.reason + ". Please check your credentials.")
|
||||||
return json.loads(response.text)
|
return json.loads(response.text)
|
||||||
|
|
||||||
def _check_auth(self):
|
def _check_auth(self):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue