Skip to content

Commit 6d87577

Browse files
Refactor session initialization for better flexibility
Switched to accommodate unauthenticated sessions by defaulting to a warning log instead of raising an exception. Updated logging messages to reflect the session status (authenticated or unauthenticated). Improved type clarity by specifying `cli_options` as a dictionary.
1 parent 3f96131 commit 6d87577

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

services/SessionManager.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
load_dotenv()
88

99

10-
def initialize(cli_options):
10+
def initialize(cli_options: dict):
1111
leetcode_session = cli_options.get("leetcode_session") or os.getenv(
1212
"LEETCODE_SESSION"
1313
)
1414
if not leetcode_session:
15-
raise ValueError(
16-
"❌ Missing LEETCODE_SESSION. Provide it via CLI or as an environment variable."
17-
)
15+
log("Using unauthenticated session", LogLevel.WARN)
16+
return
1817

1918
os.environ["LEETCODE_SESSION"] = leetcode_session
20-
log("LeetCode session initialized successfully.", LogLevel.DEBUG)
19+
log("Using authenticated session", LogLevel.DEBUG)

0 commit comments

Comments
 (0)