feat: persist email to config file

This commit is contained in:
2026-01-04 16:37:51 +01:00
parent 2d765bbf04
commit b3ebd56151

View File

@@ -1,11 +1,12 @@
"""Configuration helpers for the Auditui app.""" """Configuration helpers for the Auditui app."""
import json
from getpass import getpass from getpass import getpass
from pathlib import Path from pathlib import Path
import audible import audible
from .constants import AUTH_PATH from .constants import AUTH_PATH, CONFIG_PATH
def configure( def configure(
@@ -33,6 +34,11 @@ def configure(
auth_path.parent.mkdir(parents=True, exist_ok=True) auth_path.parent.mkdir(parents=True, exist_ok=True)
authenticator.to_file(str(auth_path)) authenticator.to_file(str(auth_path))
config = {"email": email}
with open(CONFIG_PATH, "w", encoding="utf-8") as f:
json.dump(config, f)
print("Authentication successful!") print("Authentication successful!")
audible_client = audible.Client(auth=authenticator) audible_client = audible.Client(auth=authenticator)
return authenticator, audible_client return authenticator, audible_client