From efbd564ca741d1e587740b8a3bc587d5e504b837 Mon Sep 17 00:00:00 2001 From: Nathan Henrie Date: Sun, 19 May 2024 14:40:51 -0600 Subject: [PATCH] Enum wasn't giving the expected name with `str` str(MyEnumVariant) was giving e.g. `BrowserType.CHROME`; `MyEnumVariant.title()` seems to work fine. `MyEnumVariant.name.title()` also works fine. --- src/pycookiecheat/chrome.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pycookiecheat/chrome.py b/src/pycookiecheat/chrome.py index e861ea2..17f6832 100644 --- a/src/pycookiecheat/chrome.py +++ b/src/pycookiecheat/chrome.py @@ -175,6 +175,8 @@ def get_linux_config(browser: BrowserType) -> dict: "cookie_file": cookie_file, } + browser_name = browser.title() + # Try to get pass from Gnome / libsecret if it seems available # https://github.com/n8henrie/pycookiecheat/issues/12 key_material = None @@ -195,7 +197,7 @@ def get_linux_config(browser: BrowserType) -> dict: # While Slack on Linux has its own Cookies file, the password # is stored in a keyring named the same as Chromium's, but with # an "application" attribute of "Slack". - keyring_name = f"{browser} Safe Storage" + keyring_name = f"{browser_name} Safe Storage" for unlocked_keyring in unlocked_keyrings: for item in unlocked_keyring.get_items(): @@ -220,8 +222,8 @@ def get_linux_config(browser: BrowserType) -> dict: if key_material is None: try: key_material = keyring.get_password( - f"{browser} Keys", - f"{browser} Safe Storage", + f"{browser_name} Keys", + f"{browser_name} Safe Storage", ) except RuntimeError: logger.info("Was not able to access secrets from keyring")