Skip to content

Commit

Permalink
Enum wasn't giving the expected name with str
Browse files Browse the repository at this point in the history
str(MyEnumVariant) was giving e.g. `BrowserType.CHROME`;
`MyEnumVariant.title()` seems to work fine. `MyEnumVariant.name.title()`
also works fine.
  • Loading branch information
n8henrie committed May 19, 2024
1 parent 3893822 commit efbd564
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pycookiecheat/chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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():
Expand All @@ -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")
Expand Down

0 comments on commit efbd564

Please sign in to comment.