Small ecommerce owners and competitive-intelligence consultants need daily price snapshots across two or three marketplaces. Scavio's Amazon, Walmart, and Google Shopping endpoints feed the same JSON shape into a tracker. This tutorial builds the daily run plus alert pipeline.
Prerequisites
- Python 3.10+
- Scavio API key
- DuckDB or Postgres
Walkthrough
Step 1: Define watchlist
List of (sku, label, sources) tuples.
WATCHLIST = [
('B08Z6HVSL5', 'lego star wars 75300', ['amazon', 'walmart', 'google_shopping']),
# add more...
]Step 2: Pull Amazon price
ASIN-based lookup.
import requests, os
API_KEY = os.environ['SCAVIO_API_KEY']
def amazon_price(asin):
r = requests.post('https://api.scavio.dev/api/v1/amazon/product',
headers={'x-api-key': API_KEY},
json={'asin': asin})
return r.json().get('price')Step 3: Pull Walmart price
Walmart product lookup by ID.
def walmart_price(walmart_id):
r = requests.post('https://api.scavio.dev/api/v1/walmart/product',
headers={'x-api-key': API_KEY},
json={'product_id': walmart_id})
return r.json().get('price')Step 4: Pull Google Shopping
SERP shopping search returns merchant offers.
def shopping(query):
r = requests.post('https://api.scavio.dev/api/v1/google',
headers={'x-api-key': API_KEY},
json={'query': query, 'search_type': 'shopping'})
return r.json().get('shopping_results', [])Step 5: Store and alert
DuckDB row per (sku, source, price, date); alert on threshold drops.
import duckdb
db = duckdb.connect('prices.duckdb')
db.execute('CREATE TABLE IF NOT EXISTS prices(sku TEXT, source TEXT, price FLOAT, date DATE)')
def alert_if_drop(sku, source, price):
last = db.execute('SELECT price FROM prices WHERE sku=? AND source=? ORDER BY date DESC LIMIT 1', (sku, source)).fetchone()
if last and price < last[0] * 0.9:
# send alert
passPython Example
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']
def snapshot(asin, walmart_id, query):
a = requests.post('https://api.scavio.dev/api/v1/amazon/product',
headers={'x-api-key': API_KEY}, json={'asin': asin}).json()
w = requests.post('https://api.scavio.dev/api/v1/walmart/product',
headers={'x-api-key': API_KEY}, json={'product_id': walmart_id}).json()
g = requests.post('https://api.scavio.dev/api/v1/google',
headers={'x-api-key': API_KEY}, json={'query': query, 'search_type': 'shopping'}).json()
return {'amazon': a.get('price'), 'walmart': w.get('price'), 'shopping': g.get('shopping_results',[])[:5]}
print(snapshot('B08Z6HVSL5', 'WL12345', 'lego 75300'))JavaScript Example
const API_KEY = process.env.SCAVIO_API_KEY;
export async function snapshot(asin, walmartId, query) {
const headers = { 'x-api-key': API_KEY, 'Content-Type': 'application/json' };
const [a, w, g] = await Promise.all([
fetch('https://api.scavio.dev/api/v1/amazon/product', { method:'POST', headers, body: JSON.stringify({ asin }) }).then(r => r.json()),
fetch('https://api.scavio.dev/api/v1/walmart/product', { method:'POST', headers, body: JSON.stringify({ product_id: walmartId }) }).then(r => r.json()),
fetch('https://api.scavio.dev/api/v1/google', { method:'POST', headers, body: JSON.stringify({ query, search_type: 'shopping' }) }).then(r => r.json())
]);
return { a, w, g };
}Expected Output
Daily price snapshots per SKU across Amazon, Walmart, and Google Shopping. Alerts fire on >10% price drops. DuckDB stores history for trend analysis.