Skip to content

USE CASE / SOCIAL & MESSAGING

Instagram proxy workflows

Use isolated browser sessions for permitted public-profile and display QA. Keep the route consistent while checking related profile elements so network changes do not obscure the result.

In this guide

WORKFLOW SNAPSHOT

  • Compare a public profile’s visible layout across a controlled set of visitor conditions.
  • Suggested starting behavior: Timed session
  • Validate the real application and destination

A practical Instagram workflow

Compare a public profile’s visible layout across a controlled set of visitor conditions.

  • Define the public profile, locale, and browser viewport.
  • Keep the cookie jar and route together during each observation.
  • Check whether the response is a profile, a login page, or an unavailable-content screen.

Where should an Instagram session boundary sit in a proxy test?

Treat the profile page and its dependent requests as one observation. Keep the assignment stable for that observation and rotate only between independent runs where the workflow calls for it. A short session window that expires mid-load can create an avoidable extra variable.

What should you verify before scaling Instagram profile observations?

An IP change does not create consent to collect private content or permission to automate account activity. Visual availability can vary for reasons unrelated to the proxy.

Validate the expected page structure and capture the browser conditions alongside the observation.

Verify the Instagram connection boundary

Check that the returned document is the public profile you expected rather than a login or verification view. Record browser locale, visitor state and viewport because they can change the visible layout independently of the proxy.

Classify an Instagram profile response before layout QA

Save one public-profile HTTP response to identify a profile, unavailable-content document or login view before running browser assertions.

  1. 01
    Generate your endpoint

    Choose HTTP / HTTPS and Sticky session for the complete workflow in Configure proxies.

  2. 02
    Set your proxy URL

    Set PS_PROXY_URL to http://USERNAME:PASSWORD@HOST:PORT using your generated endpoint. For IP authentication, whitelist your machine and use http://HOST:PORT. Percent-encode special characters in credentials; these are proxy credentials, separate from your account password or API key.

  3. 03
    Choose the destination

    Set PS_TARGET_URL before running the code. Use the exact permitted public Instagram profile URL for the layout scenario; omit private-content links and any session-bearing parameters.

    Example URL · replace placeholders with your targethttps://www.instagram.com/PUBLIC_HANDLE/

    Set PS_EXPECT_TEXT to the public username or a profile-specific text substring present in the document. This optional check inspects the returned text without running JavaScript.

ps_instagram.pySave one public-profile HTTP response to identify a profile, unavailable-content document or login view before running browser assertions.
Before you runPython 3.10+ · python -m pip install requests · python ps_instagram.py
# Save one public-profile HTTP response to identify a profile, unavailable-content document or login view before running browser assertions.
# Set PS_TARGET_URL to the exact permitted public Instagram profile URL for the layout scenario; omit private-content links and any session-bearing parameters.
import hashlib
import json
import os
import time
from pathlib import Path
from urllib.parse import urlsplit

import requests

class InspectSession(requests.Session):
    # Leave redirect bodies streamed instead of preparing the next request.
    def resolve_redirects(self, *args, **kwargs):
        return iter(())

proxy = os.environ["PS_PROXY_URL"]  # HTTP endpoint from ProxySight
target = os.environ["PS_TARGET_URL"]  # https://www.instagram.com/PUBLIC_HANDLE/
if urlsplit(proxy).scheme != "http":
    raise ValueError("Use your generated HTTP proxy endpoint for this example.")
if urlsplit(target).scheme not in ("http", "https"):
    raise ValueError("PS_TARGET_URL must be an HTTP or HTTPS URL.")

with InspectSession() as client:
    client.trust_env = False  # No ambient proxy, NO_PROXY or netrc overrides
    started = time.monotonic()
    with client.get(
        target,
        proxies={"http": proxy, "https": proxy},
        headers={"Accept-Language": "en-US,en;q=0.9"},
        timeout=(10, 20), allow_redirects=False, stream=True,
    ) as response:
        body = bytearray()
        for chunk in response.iter_content(16384):
            body.extend(chunk)
            if len(body) > 1048576:
                raise RuntimeError("Response exceeds this example's 1 MiB limit.")
        Path("instagram-profile-classification.html").write_bytes(body)
        print(json.dumps({
            "workflow": "instagram", "status": response.status_code,
            "elapsed_ms": round((time.monotonic() - started) * 1000),
            "bytes": len(body), "sha256": hashlib.sha256(body).hexdigest(),
            "headers": {name: response.headers.get(name) for name in ['Content-Type', 'Content-Language', 'Location']},
        }, indent=2))
        expected = os.getenv("PS_EXPECT_TEXT", "")
        if expected:
            text = body.decode(response.encoding or "utf-8", errors="replace")
            print("Expected text:", "found" if expected in text else "absent")
        # A 200 status alone does not prove the intended page was returned.
        # Inspect redirects, login prompts, 403 and 429 before another request.
Understand the result

Look for the expected profile identity in the body and inspect the status and content type when it is absent; an access screen can also return HTML successfully, while viewport-dependent layout and client-rendered elements still require the controlled browser scenario.

Response bodies are limited to 1 MiB for a small diagnostic. TLS verification stays enabled; redirects are left for you to inspect. Connection guide

Example: verify a public profile layout reproducibly

Define a public-profile presentation assertion rather than a vague requirement that Instagram should work. For example, the test may check whether the expected profile identity appears and whether a known public element is present. Keep viewport and browser state together while comparing observations.

Classify an access-required page, unavailable content, and the expected profile separately. This helps a UI test report a meaningful outcome instead of treating every missing element as a network outage.

Illustrative observation record · replace with your test data
{
  "handle": "PUBLIC_HANDLE",
  "viewport": "RECORD_VIEWPORT",
  "page_state": "RECORD_STATE",
  "expected_element": "RECORD_ASSERTION",
  "result": "RECORD_RESULT"
}

Instagram verification checklist

For this Instagram workflow, record profile, viewport and page state alongside the actual result. Use the evidence below to decide whether another observation is comparable before increasing the workload.

CheckpointHold constant or recordExpected evidence
ProfileExact public handleThe expected profile identity
ViewportDevice size and browser versionA comparable layout
Page stateProfile, access-required, or unavailableA correctly classified observation

Troubleshoot Instagram results and connection errors

SymptomCheck nextWhat the result tells you
Expected element absentConfirm page state firstA different document can explain missing selectors
Layout differsCompare viewport and localeA UI variation may be independent of route
Unexpected accountCheck isolated browser contextSession storage selected another visitor state

Keep Instagram layout comparisons tied to the same page state

Choose a known profile and list the public layout elements under review. Compare like-for-like visitor contexts, save the actual page outcome and record missing fields explicitly. Treat an unavailable element as a result to classify before changing selectors or increasing concurrency.

A LITTLE CLARITY

Common questions.

Are static exits the same as isolated Instagram identities?

No. Account identity and browser storage remain application state; an exit assignment is only a network property.

Why record the page state before checking selectors?

Selectors are meaningful only on the expected document. A login or unavailable screen should be classified before a profile assertion runs.

What should you verify before scaling Instagram profile observations?

Check that the returned document is the public profile you expected rather than a login or verification view. Record browser locale, visitor state and viewport because they can change the visible layout independently of the proxy.

PUT THE KNOWLEDGE TO WORK

Your workflow.
Your next connection.

Try the controls, choose your IP behavior, and start with one clear connection check.

Explore the configurator ↗