DEV Community

Louis Terrell
Louis Terrell

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

Find which Shopify apps a niche uses with Python

Originally published on the apiwren API guides.

In this tutorial you will build a market research script for Shopify app developers and agencies. It reads live US stores in an industry, counts the apps they have installed, and prints each app's share in that niche next to its install count across all of Shopify. It uses the Shopify Stores 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 Shopify Stores 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.

"""See which Shopify apps stores in a niche install, compared with all of Shopify.

Uses the Shopify Stores API on RapidAPI:
https://rapidapi.com/apiwren-apiwren-default/api/shopify-stores-api-search-apps-leads-contacts
"""
import os, sys, time
from collections import Counter
import requests

HOST = "shopify-stores-api-search-apps-leads-contacts.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. Count apps in a niche

/stores with an industry filter returns stores with their apps list. We count apps over two pages (100 stores).

def niche_apps(industry, country="US", pages=2):
    counts, n, cursor = Counter(), 0, None
    for _ in range(pages):
        body = get("/stores", industry=industry, country=country, status="alive",
                   **({"cursor": cursor} if cursor else {}))
        for s in body["data"]:
            n += 1
            counts.update(s["apps"] or [])
        cursor = body.get("next_cursor")
        if not cursor:
            break
    return n, counts
Enter fullscreen mode Exit fullscreen mode

4. Compare with all of Shopify

/apps returns every app name with the number of live stores using it, so you can tell niche favorites from apps that are everywhere.

def main(industry):
    overall = {a["name"]: a["stores"] for a in get("/apps")["data"]}
    n, counts = niche_apps(industry)
    if not n:
        sys.exit(f"no stores for industry {industry!r}: copy the exact value from a store record")
    print(f"{industry}: apps found on {n} live US stores")
    print("app".ljust(44) + "niche share   stores on all Shopify")
    for app, c in counts.most_common(15):
        print(f"{app[:43].ljust(44)}{c / n:10.0%}   {overall.get(app, 0):12,}")


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

5. Run it

python shopify_app_usage.py "Business & Industrial"
Enter fullscreen mode Exit fullscreen mode

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

Business & Industrial: apps found on 100 live US stores
app                                         niche share   stores on all Shopify
Google & YouTube                                   51%        740,269
Facebook & Instagram                               27%        853,921
Klaviyo: Email Marketing & SMS                     15%        287,563
Judge.me Product Reviews App                       13%        388,835
TikTok                                              9%        243,825
Pinterest                                           7%        229,057
Shopify Forms                                       5%        140,458
Mailchimp Email SMS Marketing                       5%         86,533
Powerful Contact Form Builder                       5%         22,256
Termzy ‑ I Agree To Terms                           4%            502
Omnisend Email Marketing & SMS                      4%         31,985
PageFly ✦ AI Page Builder                           4%         60,263
SA Request a Quote, Hide Price                      3%          2,129
Hulk Bundles Quantity Breaks                        3%          1,197
Globo Product Options, Variant                      3%         20,986
Enter fullscreen mode Exit fullscreen mode

The complete script is in examples/shopify_app_usage.py.

Tips

  • Read the industry values from a store record (industry field), then reuse them here.
  • An app with a high niche share but a modest global count is a niche favorite worth studying.
  • Three requests per run: one /apps call and two pages of stores.

Next steps

Top comments (0)