Skip to content

USE CASE / DEVICES & TOOLS

Authorized bot automation proxy workflows

Use bounded automation for tasks you own or are permitted to run, with deliberate sessions, finite retries, and assertions on the result.

In this guide

WORKFLOW SNAPSHOT

  • Build a small deterministic workflow that stops safely when the expected page or authorization is absent.
  • Suggested starting behavior: Timed session
  • Validate the real application and destination

A practical Authorized bot automation workflow

Build a small deterministic workflow that stops safely when the expected page or authorization is absent.

  • Define permitted targets and actions in the job configuration.
  • Keep credentials in a secret store and separate browser contexts.
  • Set concurrency, retry budgets, and a clear stopping condition.

Where should an authorized bot keep its timed session coherent?

Keep one assignment across the smallest coherent authorized scenario. A reconnect or assignment change should be a named test step, not an accidental side effect of a short expiry window. Use independent contexts for unrelated fixtures.

Which bot assertions and retry limits must pass before adding workers?

Automation that repeatedly submits an action can duplicate work even when the network response is lost. A proxy does not remove the need for idempotent task design.

Assert the completed state before retrying a mutation, and log redacted job identifiers rather than secrets.

Verify the Authorized bot automation connection boundary

Assert expected page identity, authorization, required fields and completion after each important transition. Treat sign-in prompts and verification pages as separate outcomes. A timeout after submission needs a completion check before an action is repeated.

Assert a bot's starting document before its next step

Fetches the approved starting document and reports whether a user-supplied expected-state marker exists before any separate automation step.

  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 a read-only starting page or deterministic fixture on a site you own or are authorized to automate, with an explicit expected state and a bounded request budget.

    Example URL · replace placeholders with your targethttps://example.com/qa/bot-start-state.html

    Set PS_EXPECT_TEXT to the exact safe-to-continue state marker defined by your authorized workflow. This optional check inspects the returned text without running JavaScript.

ps_bot_automation.pyFetches the approved starting document and reports whether a user-supplied expected-state marker exists before any separate automation step.
Before you runPython 3.10+ · python -m pip install requests · python ps_bot_automation.py
# Fetches the approved starting document and reports whether a user-supplied expected-state marker exists before any separate automation step.
# Use a read-only starting page or deterministic fixture on a site you own or are authorized to automate, with an explicit expected state and a bounded request budget.
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://example.com/qa/bot-start-state.html
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("bot-start-state.html").write_bytes(body)
        print(json.dumps({
            "workflow": "bot-automation", "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

Check the response class and marker together; a missing marker, sign-in screen or rate-limit response should stop dependent automation. The GET performs no workflow mutation and cannot verify that a prior action completed, so inspect completed state through the supported application before retrying an uncertain action.

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: make retries depend on completed state

An authorized automation job needs a known input, target scope, expected result, and stopping condition. For an action that changes state, a lost response does not prove the action failed.

Check the completed state or an available operation identifier before considering a repeat. Keep the retry budget finite and preserve redacted job identifiers so failures are traceable.

Illustrative observation record · replace with your test data
{
  "job_id": "YOUR_JOB_ID",
  "approved_target": "RECORD_TARGET",
  "operation_state": "RECORD_STATE",
  "retry_budget": "YOUR_LIMIT",
  "assertion": "RECORD_RESULT"
}

Authorized bot automation verification checklist

For this Authorized bot automation workflow, record scope, completion and retry alongside the actual result. Use the evidence below to decide whether another observation is comparable before increasing the workload.

CheckpointHold constant or recordExpected evidence
ScopePermitted targets and actionsControlled job
CompletionSemantic result or operation identifierKnown action state
RetryBudget and safe repetition ruleNo blind duplicate mutation

Troubleshoot Authorized bot automation results and connection errors

SymptomCheck nextWhat the result tells you
Timeout after submissionInspect completed stateThe action may have succeeded
Script ends on wrong pageValidate document and assertionExecution completion is insufficient
Retry volume growsInspect failure classesRepeated parser faults may dominate

Stop the automation when the expected state is absent

Run one deterministic fixture against the approved destination. Record input version, expected assertions, attempt count and the failure stage. Increase worker count only when the stopping rule, retry budget and destination capacity are explicit.

A LITTLE CLARITY

Common questions.

Should failed automated actions be retried immediately?

Not blindly. Determine whether the action completed and apply the job’s bounded retry policy.

What is the key difference between retrying a read and a mutation?

A mutation may already have changed state despite a lost response, so completion must be checked before repetition.

Which bot assertions and retry limits must pass before adding workers?

Assert expected page identity, authorization, required fields and completion after each important transition. Treat sign-in prompts and verification pages as separate outcomes. A timeout after submission needs a completion check before an action is repeated.

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 ↗