Gracefully handle missing pyotp so backend always starts
This commit is contained in:
parent
f5762de2b4
commit
1b3be0437d
@ -198,7 +198,10 @@ def _perform_zerodha_login(
|
|||||||
request_id = login_data["data"]["request_id"]
|
request_id = login_data["data"]["request_id"]
|
||||||
|
|
||||||
# Step 2: TOTP — don't follow redirect automatically
|
# Step 2: TOTP — don't follow redirect automatically
|
||||||
import pyotp # imported here so missing package doesn't crash startup
|
try:
|
||||||
|
import pyotp
|
||||||
|
except ImportError:
|
||||||
|
raise AutoLoginError("pyotp is not installed on the server. Run: pip install pyotp==2.9.0")
|
||||||
totp_value = pyotp.TOTP(totp_secret).now()
|
totp_value = pyotp.TOTP(totp_secret).now()
|
||||||
twofa_resp = session.post(
|
twofa_resp = session.post(
|
||||||
KITE_TWOFA_ENDPOINT,
|
KITE_TWOFA_ENDPOINT,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user