LoginRequired

Instagram told the session to log in again.

The error#

LoginRequired is raised when the private API JSON message is login_required. The class docstring shows an example payload:

You've Been Logged Out
Please log back in.

Those two strings are error_title and error_body in the docstring's example. The exception message is the JSON message when it is set, so it is often the literal login_required.

ClientLoginRequired is the other class. Its docstring says Instagram redirected to https://www.instagram.com/accounts/login/. The web profile GraphQL path raises it with Session is required for web profile GraphQL when no session is set.

What triggers it#

HTTP 403 and message == "login_required" in private_request. The public and GraphQL mixins raise ClientLoginRequired when the HTTP client was redirected at login. A 401 is ClientUnauthorizedError, logged as Status 401: Unauthorized.

How to confirm#

type(e).__name__ is LoginRequired or ClientLoginRequired. The private one carries login_required. The web one mentions the login URL or Session is required for web profile GraphQL.

Fixes#

LoginRequired means this session is dead. Build a new client and log in again, or load a session that Instagram still accepts. Retrying the same settings object keeps sending the logged-out session. ClientLoginRequired on the web profile path is the same fact: that call will not run without a session.

SocialScrape#

Instagram profile is GET /v1/instagram/profile. A private account comes back with is_private true. Posts are GET /v1/instagram/profile/posts, and one post is GET /v1/instagram/post.

Failed requests cost 0 credits. New accounts get 100 credits on signup, no card. Codes are on errors.

Questions

Does SocialScrape use an Instagram session?

No. GET /v1/instagram/profile is a logged-out read.

Is login_required a challenge?

No. challenge_required is ChallengeRequired.