Skip to content

USE CASE / COMMERCE & OPERATIONS

Price aggregation proxy workflows

Aggregate permitted public prices with product matching, regional context, and freshness rules that make the results comparable.

In this guide

WORKFLOW SNAPSHOT

  • Build a normalized observation for the same product across selected public sources.
  • Suggested starting behavior: Per-request rotation
  • Validate the real application and destination

A practical Price aggregation workflow

Build a normalized observation for the same product across selected public sources.

  • Match identifiers, variants, condition, and seller.
  • Record currency, tax display, shipping context, and timestamp.
  • Keep stale, missing, and unavailable offers distinct from zero prices.

When should price observations use independent proxy assignments?

Use independent assignments for independent permitted source observations where needed. Keep a product page and related delivery or variant checks coherent. A new IP should not silently change currency, visitor state or the product variant being compared.

Which product, seller and price fields must match before aggregation scales?

A lowest displayed price may apply to a different variant or exclude costs. A proxy route cannot resolve a product-matching error.

Validate total displayed conditions and sample matches manually before publishing aggregate comparisons.

Verify the Price aggregation connection boundary

Record product and variant identifiers, seller, condition, currency, tax basis, shipping and timestamp. Distinguish a displayed item price from a verified landed total and keep unavailable offers explicit.

Capture an offer before normalizing its price

Fetches a single offer source and preserves the raw returned price and availability document before normalization or aggregation.

  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 one permitted public offer URL for a matched product, exact variant, seller and condition; record currency and displayed tax and shipping context alongside the URL.

    Example URL · replace placeholders with your targethttps://example.com/offers/matched-product-variant

    Set PS_EXPECT_TEXT to the stable product-and-variant identifier used by your offer matcher. This optional check inspects the returned text without running JavaScript.

ps_price_aggregation.pyFetches a single offer source and preserves the raw returned price and availability document before normalization or aggregation.
Before you runPython 3.10+ · python -m pip install requests · python ps_price_aggregation.py
# Fetches a single offer source and preserves the raw returned price and availability document before normalization or aggregation.
# Use one permitted public offer URL for a matched product, exact variant, seller and condition; record currency and displayed tax and shipping context alongside the URL.
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/offers/matched-product-variant
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("price-offer-source.html").write_bytes(body)
        print(json.dumps({
            "workflow": "price-aggregation", "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

Verify the product marker and document class, then inspect cache age and raw price wording before assigning freshness or availability. The GET does not compute a landed total or resolve product matches; keep missing shipping, tax and unavailable amounts as unknown rather than zero.

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: preserve total-price context and missing states

Normalize product identity before aggregating amounts. Keep seller, variant, condition, currency, displayed tax and shipping context, availability, and observation time with every offer.

Use explicit stale, missing, and unavailable states. Treating a missing amount as zero can create a false lowest-price result that looks convincing in a dashboard.

Illustrative observation record · replace with your test data
{
  "product_key": "MATCHED_PRODUCT",
  "seller": "RECORD_SELLER",
  "currency": "RECORD_CURRENCY",
  "offer_state": "RECORD_STATE",
  "observed_at": "RECORD_TIMESTAMP"
}

Price aggregation verification checklist

For this Price aggregation workflow, record product match, cost context and data 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
Product matchIdentifier, variant, conditionEquivalent item
Cost contextCurrency and displayed costsComparable amount
Data stateFresh, stale, missing, unavailableNo invented zero-price offer

Troubleshoot Price aggregation results and connection errors

SymptomCheck nextWhat the result tells you
Lowest price looks implausibleCheck missing-state handlingAn absent value may have become zero
Sources disagreeCompare variant and total contextOffers may not be equivalent
Duplicate offersCheck seller and record identityAvoid inflated coverage

Normalize comparable offers without losing the original price context

Build a small normalized sample while retaining raw price text and units. Verify that records refer to the same product and condition before comparing values. Treat missing shipping or tax as unknown, not zero, and review outliers against their source pages.

A LITTLE CLARITY

Common questions.

What makes a price record comparable?

Matched product identity, consistent cost context, and a known observation time are essential.

Why should unavailable offers stay in the dataset?

Their explicit state documents coverage and prevents unavailable data from becoming a misleading valid price.

Which product, seller and price fields must match before aggregation scales?

Record product and variant identifiers, seller, condition, currency, tax basis, shipping and timestamp. Distinguish a displayed item price from a verified landed total and keep unavailable offers explicit.

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 ↗