DEV Community

Louis Terrell
Louis Terrell

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

Analyze an eBay competitor seller in Python

Originally published on the apiwren API guides.

In this tutorial you will build a script that profiles an eBay seller: feedback score, percent positive, detailed seller ratings, how many listings they run and their median price. It also ranks their best-selling listings by units sold, with a gross sales estimate. It uses the eBay Data API and about 45 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 eBay Data API on RapidAPI and subscribe to the free Basic plan (20 requests a month).
  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.

"""Analyze an eBay seller: feedback, best-selling listings and price points.

Uses the eBay Data API on RapidAPI:
https://rapidapi.com/apiwren-apiwren-default/api/ebay-data-api-search-item-details-seller
"""
import os, sys, time
from statistics import median
import requests

HOST = "ebay-data-api-search-item-details-seller.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. Fetch profile and listings

/seller-profile returns feedback_score, percent_positive, member_since, location and detailed_ratings. /seller-items returns the seller's active listings, up to 240 a page, with quantity_sold on each.

def seller(name, country="US"):
    profile = get("/seller-profile", seller=name, country=country)["data"]
    items = get("/seller-items", seller=name, country=country, page_size=120)["data"]
    return profile, items
Enter fullscreen mode Exit fullscreen mode

4. Rank the best sellers

Units sold times the current price gives a rough gross sales figure per listing, enough to see where a competitor makes money.

def main(name):
    p, page = seller(name)
    items = page["items"]
    r = p["detailed_ratings"] or {}
    print(f"{p['seller']}  member since {p['member_since']}  {p['location']}")
    print(f"feedback {p['feedback_score']:,}  positive {p['percent_positive']}%  "
          f"ratings: " + ", ".join(f"{k.replace('_', ' ')} {v}" for k, v in r.items()))
    prices = [i["price"] for i in items if i["price"]]
    print(f"{page['total_results']} active listings, {len(items)} read, median price {median(prices):.2f}")
    ranked = sorted(items, key=lambda i: i["quantity_sold"] or 0, reverse=True)[:8]
    print("\nbest sellers (units sold on the listing, price x units = gross):")
    for i in ranked:
        sold = i["quantity_sold"] or 0
        print(f"  {sold:6,} sold  {i['price']:8.2f}  gross {sold * i['price']:11,.0f}  {i['title'][:50]}")


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

5. Run it

python ebay_seller_analysis.py officialnoco
Enter fullscreen mode Exit fullscreen mode

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

officialnoco  member since Apr-14-23  United States
feedback 15,285  positive 99.9%  ratings: accurate description 5, shipping cost 5, shipping speed 5, communication 5
50 active listings, 50 read, median price 71.96

best sellers (units sold on the listing, price x units = gross):
   5,686 sold     23.96  gross     136,237  NOCO GENIUS1 6V/12V 1A Smart Battery Charger, Tric
   3,459 sold     79.96  gross     276,582  NOCO Boost Plus GB40 1000A 12V UltraSafe Portable 
   1,612 sold     39.95  gross      64,399  NOCO GENIUS2D 12V 2A Onboard Battery Charger, Tric
   1,512 sold     99.95  gross     151,124  NOCO GENIUS10 6V/12V 10A Smart Battery Charger, Tr
   1,282 sold     39.96  gross      51,229  NOCO GENIUS2 6V/12V 2A Smart Battery Charger, Tric
   1,278 sold    295.96  gross     378,237  NOCO Boost X GBX155 4250A 12V UltraSafe Portable L
   1,267 sold    159.96  gross     202,669  NOCO Boost HD GB70 2000A 12V UltraSafe Portable Li
   1,091 sold     55.96  gross      61,052  NOCO GENIUS5 6V/12V 5A Smart Battery Charger, Tric
Enter fullscreen mode Exit fullscreen mode

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

Tips

  • The seller name is the user ID in the seller's eBay profile URL.
  • Pass sort=newly_listed to /seller-items to see what a competitor launched last.
  • Run it monthly and compare quantity_sold to estimate sales per month for each listing.

Next steps

Top comments (0)