DEV Community

Louis Terrell
Louis Terrell

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

Compare Etsy competitor shops in Python

Originally published on the apiwren API guides.

In this tutorial you will build a script that takes a few Etsy shop names and prints them side by side. The table shows total sales, sales per year since the shop opened, rating, reviews, admirers and active listings. It also shows the median listing price, how many listings are on sale and how many carry a Bestseller badge. It uses the Etsy Data API and about 50 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.

"""Compare Etsy shops side by side: sales, reviews, prices and discounts.

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

HOST = "etsy-data-api-search-listings-shops-reviews.p.rapidapi.com"
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. Profile a shop

Two calls per shop. /shop-details returns the shop's sales, admirers, rating, review_count, active_listings and on_etsy_since. /shop-listings returns its first 36 active listings with price, discount_percent and is_bestseller. We turn them into one row.

def profile(shop):
    s = get("/shop-details", shop=shop)["data"]
    listings = get("/shop-listings", shop=shop, page=1)["data"]["listings"]
    prices = [x["price"] for x in listings if x["price"]]
    on_sale = [x for x in listings if x["discount_percent"]]
    years = max(date.today().year - (s["on_etsy_since"] or date.today().year), 1)
    return {
        "shop": s["name"],
        "location": s["location"],
        "since": s["on_etsy_since"],
        "sales": s["sales"],
        "sales_per_year": round((s["sales"] or 0) / years),
        "rating": s["rating"],
        "reviews": s["review_count"],
        "admirers": s["admirers"],
        "active": s["active_listings"],
        "median_price": median(prices) if prices else None,
        "on_sale": f"{len(on_sale)}/{len(listings)}",
        "bestsellers": sum(1 for x in listings if x["is_bestseller"]),
    }
Enter fullscreen mode Exit fullscreen mode

4. Print the table

One column per shop makes it easy to see who sells more per year, who prices higher and who relies on discounts.

def main(shops):
    rows = [profile(s) for s in shops]
    for field in rows[0]:
        print(field.ljust(15) + "".join(str(r[field]).ljust(22) for r in rows))


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

5. Run it

python etsy_shop_competitor_analysis.py AbbyLimworkshop PotterybyTeresa
Enter fullscreen mode Exit fullscreen mode

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

shop           AbbyLimworkshop       PotterybyTeresa       
location       Malaysia              Parma Heights, Ohio   
since          2025                  2019                  
sales          8978                  4803                  
sales_per_year 8978                  686                   
rating         4.8                   5                     
reviews        936                   2632                  
admirers       3130                  1963                  
active         222                   84                    
median_price   32.82                 40.0                  
on_sale        36/36                 1/36                  
bestsellers    0                     0
Enter fullscreen mode Exit fullscreen mode

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

Tips

  • sales_per_year is total sales divided by years on Etsy, a fair way to compare a new shop with an old one.
  • Read more /shop-listings pages (36 listings each) for a full price picture of a large shop.
  • Shop names are case sensitive as shown in the shop URL: etsy.com/shop/AbbyLimworkshop.

Next steps

Top comments (0)