Remove debug logging from auto-login (feature working)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thigazhezhilan J 2026-05-26 21:58:29 +05:30
parent bec31b9f9d
commit 18d07c1910

View File

@ -201,11 +201,6 @@ def _perform_zerodha_login(
sess_id = None
if "sess_id=" in connect_location:
sess_id = parse_qs(urlparse(connect_location).query).get("sess_id", [None])[0]
print(
f"[AUTO-LOGIN-DEBUG] connect status={connect_resp.status_code} "
f"sess_id={sess_id} cookies={list(session.cookies.keys())}",
flush=True,
)
# Follow the redirect so the server registers the sess_id against kf_session
if connect_location:
session.get(connect_location, timeout=15, allow_redirects=True)
@ -216,11 +211,6 @@ def _perform_zerodha_login(
data={"user_id": zerodha_login_id, "password": password},
timeout=15,
)
print(
f"[AUTO-LOGIN-DEBUG] login status={login_resp.status_code} "
f"body={login_resp.text[:300]}",
flush=True,
)
try:
login_data = login_resp.json()
except Exception:
@ -251,13 +241,6 @@ def _perform_zerodha_login(
timeout=15,
allow_redirects=False,
)
print(
f"[AUTO-LOGIN-DEBUG] twofa status={twofa_resp.status_code} "
f"location={twofa_resp.headers.get('Location', 'NONE')} "
f"body={twofa_resp.text[:400]}",
flush=True,
)
# Step 4: Extract request_token from twofa response (some Zerodha versions
# return redirect_url directly in the JSON body).
request_token = None
@ -290,12 +273,6 @@ def _perform_zerodha_login(
for attempt in range(10):
step_resp = session.get(next_url, timeout=15, allow_redirects=False)
location = step_resp.headers.get("Location", "")
print(
f"[AUTO-LOGIN-DEBUG] oauth_complete[{attempt}] "
f"status={step_resp.status_code} "
f"location={location[:300] if location else 'NONE'}",
flush=True,
)
if "request_token" in location:
parsed = urlparse(location)
params = parse_qs(parsed.query)