---
title: "Price Scraper: Get Product Prices as JSON with Python (2026)"
url: https://www.datawebot.com/blog/price-scraper
description: "Scrape product prices from Amazon, Walmart and other stores: price, original price, seller and GTIN as JSON, with a tested Python script that saves a CSV."
published: 2026-11-17
updated: 2026-11-17
author: Wilhendra Akmam
---

Blog

# Price scraper: get product prices from Amazon, Walmart and other stores as JSON, with Python

Scrape product prices from Amazon, Walmart and other stores: price, original price, seller and GTIN as JSON, with a tested Python script that saves a CSV.

[Wilhendra Akmam](https://www.datawebot.com/about#wilhendra-akmam) Published November 17, 2026

A price scraper is a program that reads the price a product page shows and saves it as data. Most people who search for one have the same job in mind: a list of products, in one or more stores, and a need to know what each one costs right now, without opening every page by hand.

This guide shows how to do that with a price scraper API. It starts with what a product page actually says about price, using real reads of Amazon and Walmart pages made on 16 November 2026, then gives a tested Python script of about 95 lines that reads a list of product links, saves every price to a CSV file and lines up the same product across stores by its GTIN. It ends with the checks that keep a price comparison honest and a checklist for choosing a price scraper.

## What does "price scraper" mean?

The phrase is used for three different jobs, and it helps to know which one you have:

| Job | Question it answers | Where to start |
| --- | --- | --- |
| **Price scraping** | What does this product cost on this page, right now? | This guide |
| **Price comparison** | Which sellers list this product, and who is cheapest? | Our [price comparison API](https://www.datawebot.com/solutions/price-comparison-api) |
| **Price tracking** | How has this price changed over weeks or months? | Our guide to [building a price tracker in Python](https://www.datawebot.com/blog/price-tracker-python) |

All three start with the same step: reading a price from a page. Tracking is that read repeated on a schedule and stored, and comparison is the same read across many sellers. Get the single read right and the other two are built on top of it.

There are also three ways to do the reading:

| Route | What you build | What you maintain |
| --- | --- | --- |
| **Your own scraper** | An HTTP client, an HTML parser and code that finds the price on each store's page | Request handling, retries and every change each store makes to its pages |
| **A price scraper API** | Calls to one endpoint that take a product link or a keyword | Only your own code; the provider keeps the extraction working |
| **An agent tool (MCP)** | Nothing; your AI agent calls the tool when you ask in plain language | Nothing; you check the answers the agent gives |

Writing your own is fine for one store and a few pages. It gets expensive across several stores, because each one puts its price in a different place, and each needs its own parser that has to be fixed when the page changes. The rest of this guide uses datawebot, which reads product and search pages on Amazon, Walmart, eBay, Zalando, Mercado Libre and the brand stores listed on its [scraper page](https://www.datawebot.com/scraper), and returns the same fields from all of them as JSON, over REST for your code or MCP for your agent.

## What does a product page say about price?

More than one number. Here is what a read of one Amazon product page returned on 16 November 2026 at 21:33 UTC, for the Keurig K-Mini coffee maker in black:

| Field | Value from the read | What it tells you |
| --- | --- | --- |
| `price` | `{"amount": 69.35, "currency": "USD", "text": "$69.35"}` | The price a shopper pays for the item on the page |
| `original_price` | USD 99.99 | The struck-through price the store shows next to it |
| `details.discount_label` | -31% | The store's own discount badge |
| `details.seller` | Manny's Hardware, type `marketplace` | Who sells the listing: the store itself or a third-party seller |
| `details.ships_from` | Amazon | Who ships it, which can differ from who sells it |
| `details.shipping_price` | 0 | Shipping on top of the price |
| `details.delivery` | FREE delivery Friday, November 20 | The delivery promise as the page states it |
| `details.offers_count` | 32 | How many other offers the page lists for the item |
| `details.offers_min_price` | 43.54 | The lowest of those offers |
| `details.stock` | 2 | The quantity the page shows as left, when it shows one |
| `details.variants` | 6 colors, each with its own `final_price` when the page shows it | The black version was 69.35, before discount 99.99 |
| `availability` | in_stock | Whether it can be bought |
| `meta.as_of` | 2026-11-16T21:33:56Z | When the page was read |

Two things in that table matter for any price scraper. First, the price belongs to a seller: on a marketplace, the same product page can show one seller's price while 32 other offers sit behind it, the lowest at $43.54. Second, the price belongs to a variant: the record lists six colors, and only the one that loaded carries a price. A good price scraper returns both facts with the number, so you can tell what you are comparing. The [product data page](https://www.datawebot.com/product-data) lists every field a product read returns.

A Walmart product page returns the same core fields. The read of the Instant Pot Duo 6-quart on walmart.com at 21:34 UTC came back at USD 137.99, sold by ZAI XPRESS L.L.C., a marketplace seller, with Walmart item ID 575389962 and GTIN 810028585201. The Amazon read of the same pressure cooker a second later was USD 109.99, sold by Amazon.com itself, with the same GTIN. That shared GTIN is what lets the script below match them.

## How do you scrape prices from a list of product pages with Python?

The script below takes a text file of product links, one per line, reads each page, saves one CSV row per link and then groups the rows that share a GTIN, so you see the same product's price in each store side by side. It uses the standard library only and needs Python 3.9 or later.

### Get access

Every account starts with 200 free credits, and sign-in is by email. The quickest way is to give your coding agent (Claude Code, Cursor or similar) this line:

```
set up https://mcp.datawebot.com/setup.md
```

The agent asks for your email and you approve the sign-in from the email datawebot sends. The key is saved to `~/.datawebot/credentials`, readable only by you, and the script reads it from there. On a server or in CI, put the key in an environment variable named `DATAWEBOT_API_KEY` from your secret store instead, and never commit it.

### The links

Put the product pages you want priced in a file named `urls.txt`. For this run it held the Instant Pot Duo 6-quart and the Bissell Little Green 1400B carpet cleaner, each on Amazon and on Walmart:

```
https://www.amazon.com/dp/B00FLYWNYQ
https://www.walmart.com/ip/Instant-Pot-Duo-6-Qt-Electric-Pressure-Cooker-7-in-1-with-Easy-Release-Steam-Switch-Slow-Cooker-Rice-Cooker-Steamer-and-More/575389962
https://www.amazon.com/dp/B0016HF5GK
https://www.walmart.com/ip/Bissell-Multi-Purpose-Portable-Carpet-and-Upholstery-Cleaner-1400B-Green/436861322
```

### The script

```
"""Read the current price on each product page listed in urls.txt, save the
results to prices.csv and compare prices for products that share a GTIN.
Standard library only."""
import csv, json, os, sys, time, urllib.request
from urllib.parse import urlparse

API = "https://api.datawebot.com/v1/requests"

def api_key():
    key = os.environ.get("DATAWEBOT_API_KEY")
    if key:
        return key
    # Written by the agent setup (https://mcp.datawebot.com/setup.md).
    with open(os.path.expanduser("~/.datawebot/credentials")) as f:
        return json.load(f) · ["profiles"]["https://mcp.datawebot.com"]["api_key"]

def call(method, url, body=None):
    req = urllib.request.Request(url, method=method,
        data=json.dumps(body).encode() if body else None,
        headers={"Authorization": "Bearer " + api_key(),
                 "Content-Type": "application/json",
                 "User-Agent": "price-scraper-example/1.0"})
    with urllib.request.urlopen(req, timeout=120) as r:
        return json.loads(r.read())

def ask(body):
    """Send a request; when the answer is "working", poll until it is done."""
    res = call("POST", API, body)
    for _ in range(40):
        if res.get("status") != "working":
            return res
        time.sleep(res.get("check_after_seconds") or 4)
        res = call("GET", f"{API}/{res['request_id']}")
    raise RuntimeError("still working after three minutes; try again later")

def amount(price):
    return (price or {}).get("amount")

def read_price(url):
    res = ask({"capability": "product", "url": url, "country": "US"})
    p = res["product"]
    d = p.get("details") or {}
    seller = d.get("seller") or {}
    gtins = [i["value"] for i in d.get("identifiers") or [] if i["type"] == "gtin"]
    return {
        "shop": urlparse(p["url"]).netloc.removeprefix("www."),
        "title": p["title"],
        "price": amount(p.get("price")),
        "original_price": amount(p.get("original_price")),
        "currency": (p.get("price") or {}).get("currency"),
        "availability": p.get("availability"),
        "seller": seller.get("name"),
        "seller_type": seller.get("type"),
        "gtin": " ".join(gtins),
        "url": p["url"],
        "as_of": res["meta"]["as_of"],
    }

def main(path="urls.txt"):
    with open(path) as f:
        urls = [line.strip() for line in f if line.strip()]
    rows = [read_price(u) for u in urls]
    with open("prices.csv", "w", newline="", encoding="utf-8") as f:
        w = csv.DictWriter(f, fieldnames=list(rows[0]))
        w.writeheader()
        w.writerows(rows)
    print(f"{len(rows)} prices saved to prices.csv\n")

    # Group rows that share a GTIN: the same product in different shops.
    groups = []
    for r in rows:
        ids = set(r["gtin"].split())
        g = next((g for g in groups if ids and ids & g["ids"]), None)
        if g:
            g["ids"] |= ids
            g["rows"].append(r)
        else:
            groups.append({"ids": ids, "rows": [r]})
    for g in groups:
        g["rows"].sort(key=lambda r: r["price"] if r["price"] is not None else float("inf"))
        print(g["rows"][0]["title"][:60])
        for r in g["rows"]:
            was = f", was {r['original_price']}" if r["original_price"] else ""
            print(f"  {r['shop']:<12} {r['currency']} {r['price']}{was}  {r['seller']} ({r['seller_type']})")
        print()

if __name__ == "__main__":
    main(*sys.argv[1:])
```

Run it from the folder that holds `urls.txt`:

```
python3 price_scraper.py
```

A product can carry more than one GTIN, as the Amazon Bissell page did, so the script matches rows that share any GTIN rather than requiring the whole list to be equal.

### What it printed

This is the real output of the run on 16 November 2026 at 21:38 UTC. Four product reads cost 4 credits and took about one minute in all.

```
4 prices saved to prices.csv

Instant Pot Duo 6 Qt 7-in-1 Electric Pressure Cooker, Stainl
  amazon.com   USD 109.99  Amazon.com (official)
  walmart.com  USD 137.99  ZAI XPRESS L.L.C. (marketplace)

Bissell Multi-Purpose Portable Carpet and Upholstery Cleaner
  walmart.com  USD 109.99  Trends Goods Inc (marketplace)
  amazon.com   USD 129.99  Amazon.com (official)
```

The CSV has the store, title, price, original price, currency, availability, seller, seller type, GTINs, product link and read time for every row. The Instant Pot was $28 cheaper on Amazon, sold by Amazon itself. The Bissell was $20 cheaper on Walmart, but from a marketplace seller rather than Walmart. Neither of those conclusions would be safe without the seller column, which is why the script keeps it.

To price more products, add lines to `urls.txt`. Each line is one product read and 1 credit, so the 200 free credits cover 200 product pages.

## How do you scrape prices from a search instead?

When you do not have the product links yet, start from a search. A search takes a keyword and a store, and returns every product on the results page with its price, original price, rating and review count, for 5 credits a page. Two searches for "Keurig K-Mini coffee maker" on 16 November 2026 at 21:33 UTC, each asking for six results, returned:

| Store | Organic results | Sponsored results | The K-Mini in black |
| --- | --- | --- | --- |
| amazon.com | 6 | 5 | $69.35, was $99.99 |
| walmart.com | 6 | 4 | $69.35, was $89.99 |

The sale price was the same in both stores to the cent, while the struck-through price was not: Amazon showed $99.99, Walmart $89.99. The original price is each store's own reference, so compare what shoppers pay and treat the "was" price as a label.

Sponsored listings come back in their own `sponsored` list, apart from the organic `products`, so ads never get mixed into the prices you compare. To go from a search to the script above, take the `url` of each organic result you want and add it to `urls.txt`, or pass the result's `product_id` to a product read directly.

## How do you get prices from an AI agent?

If you work in Claude, ChatGPT, Cursor or another agent that supports MCP, you do not need the script. After the setup line above, ask in plain language:

```
Use datawebot to read the price, original price and seller on these two
pages and put them in a table:
https://www.amazon.com/dp/B07GV2S1GS
https://www.walmart.com/ip/Keurig-K-Mini-Single-Serve-Coffee-Maker-Black/389238886
```

The agent calls `get_product` for each page, or `search_products` with `site` set to the store when you give it a keyword. It gets the same JSON as the REST API, so you can try a question in an agent first and move it to a scheduled script later without changing what you get. The [MCP server page](https://www.datawebot.com/mcp) lists every tool and how to connect each client.

## What should you check in price data?

The runs above show five things to check, whichever price scraper you use:

1. **Match by GTIN, not by name.** The top Walmart result for "Bissell Little Green portable carpet cleaner" was model 3369 at $74.62, while the top Amazon result was model 1400B at $129.99. Same product line, similar titles, different products with different GTINs. Comparing the two first results would have reported a $55 gap that does not exist. Our guide to [product matching](https://www.datawebot.com/blog/product-matching) covers matching when a GTIN is missing.
2. **Keep the seller with the price.** In both pairs above, one side was the store itself and the other a marketplace seller. A comparison that drops the seller mixes a retailer's own prices with third-party ones.
3. **Know which variant you priced.** The Keurig page listed six colors under one product. The price you get is for the variant the link opens, so link to the exact color or size you mean.
4. **Compare only the same currency.** The script prints the currency next to every price and saves it in the CSV. Keep it in any comparison you build, especially when you add stores in other countries.
5. **Every price is a snapshot.** Each answer is what the page showed at `meta.as_of`. Store that time with every row. If you need to know how a price moves, read again on a schedule and keep the rows, as our [price tracker guide](https://www.datawebot.com/blog/price-tracker-python) shows.

## How do you choose a price scraper?

Use this checklist when you compare providers:

| Question | Why it matters |
| --- | --- |
| Does it return the price as a number with its currency, not only as text? | You cannot sort or compare `"$69.35"` without parsing it yourself |
| Does it return the original price separately? | A discount is only visible if both numbers come back |
| Does it say who sells the listing? | A store's own price and a marketplace seller's price answer different questions |
| Does it return the GTIN? | It is the reliable way to match one product across stores |
| Are sponsored results kept apart from organic ones? | The Amazon search above returned 5 sponsored listings alongside the organic ones |
| Is every answer labelled with the time it was read? | Without it you cannot tell a stale price from a current one |
| Are failed requests free? | You should not pay for a page that did not load |
| Can an AI agent call it, not only your code? | MCP support lets you test questions in an agent before writing code |

datawebot reads what a public product page shows. It does not keep price history for you; your CSV or database is the history. For every seller of one product in one read, use the [price comparison API](https://www.datawebot.com/solutions/price-comparison-api) instead of listing each store's link yourself.

## What does it cost?

A product read costs 1 credit and a search 5 credits a page. Failed requests are free; a page that loads but has no results is still charged. Every account starts with 200 free credits, enough for 200 product prices. More credits are one-time packs with no subscription, listed on the [pricing page](https://www.datawebot.com/pricing). The [Amazon endpoint page](https://www.datawebot.com/scraper/amazon) and [Walmart endpoint page](https://www.datawebot.com/scraper/walmart) have an example request for each endpoint, and our [Amazon scraper guide](https://www.datawebot.com/blog/amazon-scraper-api) and [Walmart scraper guide](https://www.datawebot.com/blog/walmart-scraper-api) go deeper into each store's fields.

## Need this at volume?

If you need prices for thousands of products or on a regular schedule, [send a volume request](https://www.datawebot.com/volume) and we will size it in credits. Our [published samples](https://www.datawebot.com/samples) show the result format from other stores.

## Frequently asked questions

### What is a price scraper?

A program or API that reads the price shown on a product page or search page and returns it as data, usually with the original price, currency, seller and a link. With a price scraper API you send a product link or a keyword and get JSON back, without writing a parser for each store.

### How do I scrape prices with Python?

List the product pages in a text file, send each link to a product read and write the price fields to a CSV. The script in this guide does that in about 95 lines of standard-library Python, for 1 credit per product page.

### Can I scrape prices from Amazon and Walmart with the same code?

Yes. The product read returns the same fields for both stores: `price`, `original_price`, `availability`, `details.seller` and `details.identifiers`. The script in this guide reads Amazon and Walmart links from one file without any store-specific code.

### How do I compare the same product across stores?

Match on the GTIN, the product's barcode number, which is the same wherever the product is sold. The product read returns it in `details.identifiers` when the page shows it. In our run, the Instant Pot Duo carried GTIN 810028585201 on both Amazon and Walmart.

### Does a price scraper store price history?

Not by itself. A price scraper reads the price at one moment and labels it with the time. To build history, run it on a schedule and keep every row, as in our guide to [building a price tracker with an AI agent](https://www.datawebot.com/blog/price-tracker-python).

### Does it return sponsored products?

Yes, separately. In a search, sponsored listings come back in their own `sponsored` list, so the `products` list holds only organic results.

### Is there a free price scraper API?

You can start free: every datawebot account gets 200 free credits with no card, enough for 200 product prices or 40 searches. After that, credits are one-time packs with no subscription.

## Sources

1. [https://www.datawebot.com/llms.txt](https://www.datawebot.com/llms.txt)
2. [https://mcp.datawebot.com/setup.md](https://mcp.datawebot.com/setup.md)
3. [https://www.datawebot.com/scraper/amazon](https://www.datawebot.com/scraper/amazon)
4. [https://www.datawebot.com/scraper/walmart](https://www.datawebot.com/scraper/walmart)
5. [https://www.datawebot.com/scraper](https://www.datawebot.com/scraper)
6. [https://www.gs1.org/standards/id-keys/gtin](https://www.gs1.org/standards/id-keys/gtin)
7. [https://docs.python.org/3/library/csv.html](https://docs.python.org/3/library/csv.html)
8. [https://docs.python.org/3/library/urllib.request.html](https://docs.python.org/3/library/urllib.request.html)
9. [https://modelcontextprotocol.io/specification/2025-06-18/server/tools](https://modelcontextprotocol.io/specification/2025-06-18/server/tools)

## Read one product and every seller's offer as data.

Every account starts with 200 free credits, with no subscription: a search costs 5 credits and a product read 1. Failed requests are free.

[Get every seller's price for a product](https://www.datawebot.com/product-data) · [See pricing](https://www.datawebot.com/pricing)

[← All articles](https://www.datawebot.com/blog)
