fix(instagram): report an account lock instead of retrying the login

This commit is contained in:
hh committed 2026-09-07 15:35:52 +02:00
1 parent 83378b9ba5
commit f6a943ac3a
1 file changed
+9 -1
+9 -1
View File
@@ -4,7 +4,7 @@ from typing import Optional
import orjson
from curl_cffi.requests import AsyncSession
from .auth import APP_ID, UA, NoSessions, Session, SessionPool
from .auth import APP_ID, UA, LoginChallenge, NoSessions, Session, SessionPool
from .content import Audio, Item, Post
POST_RE = re.compile(
@@ -130,6 +130,14 @@ class Instagram:
except Exception:
body = None
# A locked account is not a session problem: rotating to another
# session or logging in again cannot clear it, and trying only
# burns login attempts until Instagram answers 429 instead.
if isinstance(body, dict) and body.get("checkpoint_url"):
raise LoginChallenge(
body.get("message") or "Instagram wants a checkpoint cleared"
)
# An expired session is not a 401: Instagram bounces the API call
# to /accounts/login/, which bounces back, so following redirects
# burned 30 hops and surfaced a curl error instead of a dead