fix(instagram): report an account lock instead of retrying the login
This commit is contained in:
1 parent
83378b9ba5
commit
f6a943ac3a
1 file changed
+9
-1
@@ -4,7 +4,7 @@ from typing import Optional
|
|||||||
import orjson
|
import orjson
|
||||||
from curl_cffi.requests import AsyncSession
|
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
|
from .content import Audio, Item, Post
|
||||||
|
|
||||||
POST_RE = re.compile(
|
POST_RE = re.compile(
|
||||||
@@ -130,6 +130,14 @@ class Instagram:
|
|||||||
except Exception:
|
except Exception:
|
||||||
body = None
|
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
|
# An expired session is not a 401: Instagram bounces the API call
|
||||||
# to /accounts/login/, which bounces back, so following redirects
|
# to /accounts/login/, which bounces back, so following redirects
|
||||||
# burned 30 hops and surfaced a curl error instead of a dead
|
# burned 30 hops and surfaced a curl error instead of a dead
|
||||||
|
|||||||
Reference in new issue
Block a user