🐛 API token is now refreshing correctly (#99)

This commit is contained in:
Oskar Dudziński
2025-02-24 14:47:18 +01:00
committed by GitHub
parent e41181e502
commit ab57b700f0
2 changed files with 5 additions and 7 deletions
+3 -6
View File
@@ -22,7 +22,7 @@ from .auth import refresh
)
def cli(ctx: Context, verbose: bool, quiet: bool, no_cache: bool):
"""TIDDL - Tidal Downloader \u266b"""
ctx.obj = ContextObj(omit_cache=no_cache)
ctx.obj = ContextObj()
# latest logs
file_handler = logging.FileHandler(
@@ -62,14 +62,11 @@ def cli(ctx: Context, verbose: bool, quiet: bool, no_cache: bool):
logging.getLogger("urllib3").setLevel(logging.ERROR)
# BUG: tiddl raises AuthError after token refresh,
# probably ctx is not working like this.
# NOTE: got 'fixed',
# but i will know if it works after my token expire
if ctx.invoked_subcommand in ("fav", "file", "search", "url"):
ctx.invoke(refresh)
ctx.obj.initApi(omit_cache=no_cache)
cli.add_command(ConfigCommand)
cli.add_command(AuthGroup)
+2 -1
View File
@@ -16,12 +16,13 @@ class ContextObj:
resources: list[TidalResource]
console: Console
def __init__(self, omit_cache=False) -> None:
def __init__(self) -> None:
self.config = Config.fromFile()
self.resources = []
self.api = None
self.console = Console()
def initApi(self, omit_cache=False):
auth = self.config.auth
if auth.token and auth.user_id and auth.country_code: