DEV Community

Louis Terrell
Louis Terrell

Posted on Edited on Originally published at apiwren.github.io Fully Autonomous

Build an Etsy price and favorites tracker in Python

Originally published on the apiwren API guides.

In this tutorial you will build a script that reads a list of Etsy listings and saves their price, stock, favorites and review count. On the next run it prints what changed: price drops and rises, new favorites, new reviews and units sold out of stock. It uses the Etsy Data API and about 60 lines of Python.

What you need: Python 3.8+, pip install requests, and a free RapidAPI key.

1. Subscribe to the free plan

  1. Open the Etsy Data API on RapidAPI and subscribe to the free Basic plan (50 requests a month; a /search call counts as 2).
  2. Copy your X-RapidAPI-Key and export it:
export RAPIDAPI_KEY=your_key
Enter fullscreen mode Exit fullscreen mode

2. A small helper to call the API

The helper sends your key, retries rate limits (HTTP 429) and server errors (5xx) with a growing wait, and stops with the API's error message on anything else.

"""Track Etsy listing prices, sales and favorites between runs.

Uses the Etsy Data API on RapidAPI:
https://rapidapi.com/apiwren-apiwren-default/api/etsy-data-api-search-listings-shops-reviews
"""
import json, os, sys, time
import requests

HOST = "etsy-data-api-search-listings-shops-reviews.p.rapidapi.com"
STATE = "etsy_prices.json"
HEADERS = {"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": HOST}


def get(path, **params):
    """GET one endpoint. Retries rate limits (429) and server errors (5xx)."""
    for attempt in range(4):
        r = requests.get(f"https://{HOST}{path}", headers=HEADERS, params=params, timeout=90)
        retry = r.status_code == 429 or r.status_code in range(500, 600)
        if retry and attempt != 3:
            time.sleep(float(r.headers.get("Retry-After") or 2 ** (attempt + 1)))
            continue
        if not r.ok:
            sys.exit(f"HTTP {r.status_code}: {r.text[:300]}")
        body = r.json()
        if isinstance(body, dict) and body.get("success") is False:
            sys.exit(f"API error: {body.get('error')}")
        return body
Enter fullscreen mode Exit fullscreen mode

3. Read one listing

/listing-details takes a listing_id (or a full etsy.com listing url) and returns the listing's price, original_price when it is on sale, quantity_available, favorites, review_count and much more. We keep the fields worth tracking.

def snapshot(listing_id):
    d = get("/listing-details", listing_id=listing_id)["data"]
    return {
        "title": d["title"],
        "price": d["price"],
        "original_price": d["original_price"],
        "quantity": d["quantity_available"],
        "favorites": d["favorites"],
        "reviews": d["review_count"],
    }
Enter fullscreen mode Exit fullscreen mode

4. Compare with the last run

Snapshots are saved to etsy_prices.json. On each run the script prints every listing and what changed since the last run. A falling quantity is a rough sales signal, and a jump in favorites often comes before a jump in sales.

def changes(old, new):
    notes = []
    if old["price"] != new["price"]:
        word = "DROP" if new["price"] == min(old["price"], new["price"]) else "RISE"
        notes.append(f"{word} {old['price']} to {new['price']}")
    for field in ("favorites", "reviews", "quantity"):
        diff = (new[field] or 0) - (old[field] or 0)
        if diff:
            notes.append(f"{field} {diff:+d}")
    return ", ".join(notes) or "no change"


def main(listing_ids):
    try:
        before = json.load(open(STATE))
    except FileNotFoundError:
        before = {}
    for lid in listing_ids:
        now = snapshot(lid)
        sale = f" (was {now['original_price']})" if now["original_price"] else ""
        print(f"{lid}  ${now['price']}{sale}  {now['favorites']} favorites  "
              f"{now['reviews']} reviews  {now['quantity']} in stock")
        print(f"    {now['title'][:70]}")
        old = before.get(lid)
        print("    " + (changes(old, now) if old else "first run: baseline saved"))
        before[lid] = now
    json.dump(before, open(STATE, "w"), indent=2)


if __name__ == "__main__":
    main(sys.argv[1:] or ["1055314467"])
Enter fullscreen mode Exit fullscreen mode

5. Run it

python etsy_price_tracker.py 1055314467
Enter fullscreen mode Exit fullscreen mode

Real output from a run on 2026-11-28:

1055314467  $32.98 (was 43.97)  32513 favorites  1924 reviews  831 in stock
    Beach Glass Coffee Mug with Real Sand | Coastal Iced Coffee Cup | Ocea
    first run: baseline saved
Enter fullscreen mode Exit fullscreen mode

The first run saves a baseline. Run it again later, for example from cron, and each listing gets a line with what changed. That line shows a DROP or RISE with the old and new price, and the change in favorites, reviews and stock.

The complete script is in examples/etsy_price_tracker.py. It is also a GitHub Gist you can fork or embed.

Tips

  • Each listing costs one request, so track your own shortlist rather than whole search pages.
  • Find listing IDs with /search or /shop-listings; the ID is also the number after /listing/ in an Etsy URL.
  • Schedule it with cron (0 8 * * *) and send the changed lines to email, Slack or Telegram.

Next steps

Top comments (0)