From 0446c44a42cbb1bea6ff8602467cd03808202add Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Tue, 7 Feb 2023 21:08:45 +0000 Subject: [PATCH] Only iterate over cookie dir if exists in auth list Fixes #18. --- devine/commands/auth.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/devine/commands/auth.py b/devine/commands/auth.py index 3576703..c1870bb 100644 --- a/devine/commands/auth.py +++ b/devine/commands/auth.py @@ -39,11 +39,12 @@ def list_(ctx: click.Context, service: Optional[str] = None) -> None: auth_data: dict[str, dict[str, list]] = defaultdict(lambda: defaultdict(list)) - for cookie_dir in config.directories.cookies.iterdir(): - service = cookie_dir.name - for cookie in cookie_dir.glob("*.txt"): - if cookie.stem not in auth_data[service]: - auth_data[service][cookie.stem].append("Cookie") + if config.directories.cookies.exists(): + for cookie_dir in config.directories.cookies.iterdir(): + service = cookie_dir.name + for cookie in cookie_dir.glob("*.txt"): + if cookie.stem not in auth_data[service]: + auth_data[service][cookie.stem].append("Cookie") for service, credentials in config.credentials.items(): for profile in credentials: