NativePort
← All use cases

Read product data from retail websites

Extract product facts from Walmart, Home Depot, or Costco pages for your agent to compare.

The problem

Retail sites organize product pages differently. A model can compare specifications once it has them, but it cannot reliably recover current prices and product details from memory. A parser written for one store also breaks when another store uses different page elements.

How NativePort helps

NativePort gives your agent access to Zyte’s product extraction. Supply a retail product URL and receive the product fields that can be recovered from that page. Your agent can work with a consistent record instead of interpreting each store’s HTML itself.

Technical implementation

Use Python 3 with requests installed (python -m pip install requests). Set NATIVEPORT_API_KEY in your environment to your NativePort key. Run the snippets on your server, where your key stays private.

Set RETAIL_PRODUCT_URL to one public product detail URL from the retailer you want to inspect. The example makes one extraction request. Test representative URLs from each store before scheduling a larger collection.

python
import json
import os
import requests

BASE = "https://api.nativeport.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}

url = os.environ["RETAIL_PRODUCT_URL"]
response = requests.post(
    BASE + "/zyte",
    headers=HEADERS,
    json={"url": url, "product": True},
    timeout=120,
)
response.raise_for_status()
product = response.json().get("product")
if not isinstance(product, dict) or not product.get("name"):
    raise RuntimeError("No product details extracted from this URL")
print(json.dumps({"source_url": url, "product": product},
                 indent=2, ensure_ascii=False))

The product extraction reference explains the returned schema. Coverage depends on the page: a member-only Costco price or store-specific stock figure may be unavailable. Preserve missing values rather than treating them as zero. Match the exact model, pack size, and currency before comparing two stores. Each additional product URL requires another call.

Tool costs

Tool used in the examplePrice per call
Zyte — product extraction from one retail URL $0.00211 / call

Prices in USD. Usage-based tools have no fixed per-call price. View pricing.

Let your agent build it

You don’t need to write this code yourself. Copy this page’s link and paste it into your agent. Ask it to follow the guide and implement the feature for you.