Skip to content

USE CASE / DATA & RESEARCH

Structured data collection proxy workflows

Turn permitted documents into validated records with a controlled fetch schedule and explicit schema. A proxy route is only one input to collection quality.

In this guide

WORKFLOW SNAPSHOT

  • Collect a small dataset whose fields, freshness, and duplicate rules are defined before fetching.
  • Suggested starting behavior: Per-request rotation
  • Validate the real application and destination

A practical Structured data collection workflow

Collect a small dataset whose fields, freshness, and duplicate rules are defined before fetching.

  • Specify required fields and acceptable value formats.
  • Cache unchanged documents and deduplicate source URLs.
  • Keep route, parser version, and fetch time in the record.

When should a structured-data collector rotate between observations?

Use independent assignments for independent permitted records where useful. Keep pagination or a related source journey coherent when it depends on session state. Rotation controls routing; schema validation determines whether the returned data is usable.

Which data-schema and deduplication checks must pass before scale?

A completed HTTP request can contain an error page or incomplete data. Increasing rotation will not repair a parser or an undefined schema.

Test required-field completeness and compare a manual sample before scheduling a larger run.

Verify the Structured data collection connection boundary

Define required fields, units, freshness, null handling and duplicate keys before scheduling a larger job. A successful response containing a challenge page or empty required field should not enter the dataset as a valid record.

Validate a JSON source before the extraction pipeline

Fetches a bounded JSON source, checks that it decodes as JSON and saves the exact response for your record validator.

  1. 01
    Generate your endpoint

    Choose HTTP / HTTPS and Every request for independent observations 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 an explicitly approved read-only JSON dataset URL or a fixture you control, with a small non-sensitive record sample and a documented schema.

    Example URL · replace placeholders with your targethttps://example.com/datasets/catalog-sample.json

    Set PS_EXPECT_TEXT to a required field name or stable sample-record key. This optional check inspects the returned text without running JavaScript.

ps_data_scraping.pyFetches a bounded JSON source, checks that it decodes as JSON and saves the exact response for your record validator.
Before you runPython 3.10+ · python -m pip install requests · python ps_data_scraping.py
# Fetches a bounded JSON source, checks that it decodes as JSON and saves the exact response for your record validator.
# Use an explicitly approved read-only JSON dataset URL or a fixture you control, with a small non-sensitive record sample and a documented schema.
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/datasets/catalog-sample.json
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("structured-data-source.json").write_bytes(body)
        print(json.dumps({
            "workflow": "data-scraping", "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', 'Retry-After', 'X-RateLimit-Remaining']},
        }, 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

Inspect the JSON root type, expected record marker, content type and cache metadata before passing the file to your schema checks. Parseable JSON alone does not prove required fields, freshness, deduplication or permitted reuse; validate these against the saved source.

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: validate structured records after extraction

Write the output schema before the fetch loop: stable identity, source, collection time, required fields, and allowed missing states. Separate fetching from parsing and validation so their failures remain understandable.

Use a reviewed fixture set with a normal record, an unavailable item, and a document missing optional fields. It should reveal a schema regression without requiring another live collection run.

Illustrative observation record · replace with your test data
{
  "record_key": "STABLE_KEY",
  "source_url": "RECORD_SOURCE",
  "collected_at": "RECORD_TIMESTAMP",
  "schema_version": "YOUR_SCHEMA",
  "validation": "RECORD_RESULT"
}

Structured data collection verification checklist

For this Structured data collection workflow, record identity, schema and freshness alongside the actual result. Use the evidence below to decide whether another observation is comparable before increasing the workload.

CheckpointHold constant or recordExpected evidence
IdentityStable record key and sourceDeduplication is possible
SchemaRequired fields and allowed formatsValid records distinguished from partial output
FreshnessCollection timestampThe observation has a known time

Troubleshoot Structured data collection results and connection errors

SymptomCheck nextWhat the result tells you
Requests succeed, data incompleteInspect parser and schemaTransport succeeded but extraction failed
Record count inflatedCheck duplicate keysRepeated pages may be counted twice
Missing values look plausibleUse explicit missing statesAvoid invented default data

Validate a small collected dataset before increasing concurrency

Collect a small sample and run it through the intended normalizer and validator. Save source URL, retrieval time and a rejection reason for failures. Compare accepted records with the original documents before adding workers or broadening the source list.

A LITTLE CLARITY

Common questions.

What is the best success metric for data scraping?

Valid, fresh, deduplicated records are more useful than raw request counts.

Why keep parser and schema versions?

They let you distinguish source changes from changes introduced by your own extraction pipeline.

Which data-schema and deduplication checks must pass before scale?

Define required fields, units, freshness, null handling and duplicate keys before scheduling a larger job. A successful response containing a challenge page or empty required field should not enter the dataset as a valid record.

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 ↗