mirror of
https://github.com/oskvr37/tiddl.git
synced 2026-06-13 04:05:08 +03:00
🐛 API token is now refreshing correctly (#99)
This commit is contained in:
@@ -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
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user