mirror of
https://github.com/Wojtek242/qobuz-dl.git
synced 2024-11-22 11:05:25 +01:00
Add error verbosity
This commit is contained in:
parent
3a24a4666b
commit
e586e7d868
@ -35,6 +35,7 @@ class Client:
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.base = "https://www.qobuz.com/api.json/0.2/"
|
self.base = "https://www.qobuz.com/api.json/0.2/"
|
||||||
|
self.sec = None
|
||||||
self.auth(email, pwd)
|
self.auth(email, pwd)
|
||||||
self.cfg_setup()
|
self.cfg_setup()
|
||||||
|
|
||||||
@ -109,9 +110,11 @@ class Client:
|
|||||||
raise InvalidAppIdError("Invalid app id.\n" + RESET)
|
raise InvalidAppIdError("Invalid app id.\n" + RESET)
|
||||||
else:
|
else:
|
||||||
logger.info(f"{GREEN}Logged: OK")
|
logger.info(f"{GREEN}Logged: OK")
|
||||||
elif epoint in ["track/getFileUrl", "userLibrary/getAlbumsList"]:
|
elif epoint in ["track/getFileUrl", "favorite/getUserFavorites"]:
|
||||||
if r.status_code == 400:
|
if r.status_code == 400:
|
||||||
raise InvalidAppSecretError("Invalid app secret.\n" + RESET)
|
raise InvalidAppSecretError(
|
||||||
|
f"Invalid app secret: {r.json()}.\n" + RESET
|
||||||
|
)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
||||||
@ -190,16 +193,17 @@ class Client:
|
|||||||
|
|
||||||
def test_secret(self, sec):
|
def test_secret(self, sec):
|
||||||
try:
|
try:
|
||||||
r = self.api_call("favorite/getUserFavorites", sec=sec)
|
self.api_call("favorite/getUserFavorites", sec=sec)
|
||||||
return True
|
return True
|
||||||
except InvalidAppSecretError:
|
except InvalidAppSecretError as error:
|
||||||
|
logger.info("Invalid SECRET: %s", error)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def cfg_setup(self):
|
def cfg_setup(self):
|
||||||
for secret in self.secrets:
|
for secret in self.secrets:
|
||||||
if secret:
|
if secret and self.test_secret(secret):
|
||||||
if self.test_secret(secret):
|
|
||||||
self.sec = secret
|
self.sec = secret
|
||||||
break
|
break
|
||||||
if not hasattr(self, "sec"):
|
|
||||||
|
if self.sec is None:
|
||||||
raise InvalidAppSecretError("Invalid app secret.\n" + RESET)
|
raise InvalidAppSecretError("Invalid app secret.\n" + RESET)
|
||||||
|
2
setup.py
2
setup.py
@ -13,7 +13,7 @@ requirements = read_file("requirements.txt").strip().split()
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=pkg_name,
|
name=pkg_name,
|
||||||
version="0.9.9.3",
|
version="0.9.9.4",
|
||||||
author="Vitiko",
|
author="Vitiko",
|
||||||
author_email="vhnz98@gmail.com",
|
author_email="vhnz98@gmail.com",
|
||||||
description="The complete Lossless and Hi-Res music downloader for Qobuz",
|
description="The complete Lossless and Hi-Res music downloader for Qobuz",
|
||||||
|
Loading…
Reference in New Issue
Block a user