Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion recnetlogin/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def __init__(
username: str,
password: str,
prompt_2fa: bool = False,
given_2fa: str = "",
session: aiohttp.ClientSession or httpx.Client = None,
**kwargs
) -> None:
Expand All @@ -19,4 +20,6 @@ def __init__(
# Decoded bearer token
self.decoded = {}
# Whether or not to prompt for 2fa code
self.prompt_2fa = prompt_2fa
self.prompt_2fa = prompt_2fa
# 2FA token
self.given_2fa = given_2fa
6 changes: 5 additions & 1 deletion recnetlogin/sync_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def __login(self) -> None:
return

def __login_2fa(self) -> None:
twofa_code = prompt_2fa()
if self.given_2fa:
twofa_code = self.given_2fa
else:
twofa_code = prompt_2fa()

resp = self.__session.get(ApiInfo.TWOFA_URL)
html = resp.content
Expand All @@ -48,6 +51,7 @@ def __login_2fa(self) -> None:
self.decoded = decode_token(self.bearer_token)
except TwoFactorAuthenticatorEnabled:
print(debug_text("Authenticator code is wrong!"))
raise TwoFactorAuthenticaorCodeWrong
return self.__login_2fa()

def close(self):
Expand Down