You can track Walmart product prices without scraping by searching with platform set to walmart in the Scavio API. The response returns structured product listings with current prices, which you store daily and diff for alerts.
Prerequisites
- Python 3.9+
- Scavio API key
- SQLite (stdlib)
Walkthrough
Step 1: Search Walmart for a product
Set platform:walmart to get Walmart product listings with structured price data.
import requests
API_KEY = "your-scavio-api-key"
def search_walmart(query: str, num_results: int = 10) -> list:
r = requests.post(
"https://api.scavio.dev/api/v1/search",
json={"query": query, "platform": "walmart", "num_results": num_results},
headers={"x-api-key": API_KEY},
timeout=20
)
r.raise_for_status()
return r.json().get("organic_results", [])
products = search_walmart("Sony WH-1000XM5 headphones")
for p in products:
print(p.get("title"), p.get("price"))Step 2: Track prices in SQLite
Store the product title, price, and date for each tracked item.
import sqlite3, re
from datetime import date
def init_db(path="walmart_tracker.db"):
conn = sqlite3.connect(path)
conn.execute("""
CREATE TABLE IF NOT EXISTS prices (
date TEXT, query TEXT, title TEXT, price_raw TEXT, price_usd REAL,
url TEXT, PRIMARY KEY (date, url)
)
""")
conn.commit()
return conn
def parse_price(s: str) -> float:
m = re.search(r"[\d.]+", (s or "").replace(",",""))
return float(m.group()) if m else 0.0
def store(conn, query, product):
conn.execute("INSERT OR REPLACE INTO prices VALUES (?,?,?,?,?,?)",
(str(date.today()), query, product.get("title"),
product.get("price"), parse_price(product.get("price","")),
product.get("link","")))
conn.commit()Step 3: Alert on price drops
Compare today's price with the previous day's price. Alert if drop exceeds threshold.
def check_alerts(conn, url: str, threshold_pct: float = 10.0) -> dict | None:
rows = conn.execute(
"SELECT date, price_usd, title FROM prices WHERE url=? ORDER BY date DESC LIMIT 2",
(url,)
).fetchall()
if len(rows) < 2:
return None
today_price = rows[0][1]
prev_price = rows[1][1]
if prev_price == 0:
return None
drop_pct = (prev_price - today_price) / prev_price * 100
if drop_pct >= threshold_pct:
return {
"title": rows[0][2],
"prev_price": prev_price,
"today_price": today_price,
"drop_pct": round(drop_pct, 1),
"url": url
}
return NonePython Example
import requests
import sqlite3
import re
from datetime import date
API_KEY = "your-scavio-api-key"
TRACKED = [
"Sony WH-1000XM5 headphones",
"iPad Air 2026",
"Instant Pot Duo 7-in-1"
]
def search_walmart(query, n=5):
r = requests.post("https://api.scavio.dev/api/v1/search",
json={"query": query, "platform": "walmart", "num_results": n},
headers={"x-api-key": API_KEY}, timeout=20)
r.raise_for_status()
return r.json().get("organic_results", [])
def parse_price(s):
m = re.search(r"[\d.]+", (s or "").replace(",",""))
return float(m.group()) if m else 0.0
def init_db(path="walmart_tracker.db"):
conn = sqlite3.connect(path)
conn.execute("CREATE TABLE IF NOT EXISTS prices (date TEXT, query TEXT, title TEXT, price_raw TEXT, price_usd REAL, url TEXT, PRIMARY KEY (date, url))")
conn.commit()
return conn
def run_tracker():
conn = init_db()
alerts = []
today = str(date.today())
for query in TRACKED:
products = search_walmart(query, n=3)
for p in products:
url = p.get("link","")
price_usd = parse_price(p.get("price",""))
conn.execute("INSERT OR REPLACE INTO prices VALUES (?,?,?,?,?,?)",
(today, query, p.get("title"), p.get("price"), price_usd, url))
conn.commit()
# Check alert
rows = conn.execute("SELECT date, price_usd FROM prices WHERE url=? ORDER BY date DESC LIMIT 2", (url,)).fetchall()
if len(rows) == 2 and rows[1][1] > 0:
drop = (rows[1][1] - rows[0][1]) / rows[1][1] * 100
if drop >= 10:
alerts.append({"title": p.get("title"), "drop_pct": round(drop,1),
"prev": rows[1][1], "now": rows[0][1]})
print(f"Tracked: {query} ({len(products)} products)")
if alerts:
print("\nPRICE DROP ALERTS:")
for a in alerts:
print(f" {a['title'][:50]} | ${a['prev']} -> ${a['now']} (-{a['drop_pct']}%)")
else:
print("\nNo significant price drops today.")
if __name__ == "__main__":
run_tracker()JavaScript Example
const API_KEY = 'your-scavio-api-key';
async function searchWalmart(query, n = 5) {
const res = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': API_KEY },
body: JSON.stringify({ query, platform: 'walmart', num_results: n })
});
const data = await res.json();
return data.organic_results ?? [];
}
const products = await searchWalmart('Sony WH-1000XM5 headphones');
for (const p of products.slice(0, 3)) {
console.log(`${p.title?.slice(0, 60)} | ${p.price}`);
}Expected Output
Tracked: Sony WH-1000XM5 headphones (3 products)
Tracked: iPad Air 2026 (3 products)
Tracked: Instant Pot Duo 7-in-1 (3 products)
PRICE DROP ALERTS:
Sony WH-1000XM5 Wireless Headphones (Black) | $349.00 -> $279.00 (-20.1%)