Skip to content

Map public challenge redirects to login required#2616

Merged
subzeroid merged 1 commit into
masterfrom
fix/public-challenge-jsondecode-1093
Jun 11, 2026
Merged

Map public challenge redirects to login required#2616
subzeroid merged 1 commit into
masterfrom
fix/public-challenge-jsondecode-1093

Conversation

@subzeroid

Copy link
Copy Markdown
Owner

Fixes #1093

Instagram can redirect public web GraphQL/user-info requests to /challenge/?next=... and return an HTML page with status 200. public_request(..., return_json=True) previously treated that as a generic JSON decode failure.

This maps challenge redirect HTML to ClientLoginRequired, matching the existing /login/ redirect handling and allowing existing public lookup retry/session-injection paths to run.

Verification:

  • .venv/bin/python -m pytest -q tests/regression/test_public.py::PublicRegressionTestCase::test_public_request_maps_challenge_redirect_html_to_login_required
  • .venv/bin/python -m pytest -q tests/regression/test_request_logging.py::RequestLoggingRegressionTestCase::test_public_json_decode_error_log_truncates_response_body
  • .venv/bin/python -m pytest -q tests/regression
  • .venv/bin/python -m ruff check .
  • .venv/bin/python -m ruff format --check .
  • .venv/bin/python -m bandit -c pyproject.toml -r instagrapi
  • .venv/bin/python -m build

@subzeroid subzeroid merged commit d62898d into master Jun 11, 2026
11 checks passed
@subzeroid subzeroid deleted the fix/public-challenge-jsondecode-1093 branch June 11, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSONDecodeError[BUG]

1 participant