Skip to main content

Scrape any Shopify store — products, collections, pages & metadata from the public JSON API. SDK + CLI + REST API.

Project description

# shopifyscrape

Scrape any Shopify store — products, collections, pages & metadata from the public JSON API. No API key required.

Three interfaces: Python SDK, CLI, and REST API.

Installation

# Core SDK only
pip install shopifyscrape

# With CLI (click + rich tables)
pip install shopifyscrape[cli]

# With REST API (FastAPI + uvicorn)
pip install shopifyscrape[api]

# Everything
pip install shopifyscrape[all]

Quick Start

from shopifyscrape import Shopify

shop = Shopify('spharetech.com')

# Store metadata
store = shop.store()
print(store.name, store.currency)

# All products (auto-paginated)
products = shop.products()
for p in products:
    print(p.title, p.price, p.available)

# All collections
collections = shop.collections()
for c in collections:
    print(c.title, c.products_count)

# Products in a specific collection
power_banks = shop.collection_products('power-banks')

# Single product
product = shop.product('66w-transparent-power-bank-20000mah')

# Pages
pages = shop.pages()

Pagination

Fetch everything at once or paginate manually — your choice.

shop = Shopify('spharetech.com')

# Auto-paginate: fetches ALL products in one call
all_products = shop.products()

# Manual pagination: fetch one page at a time
page1 = shop.products_page(page=1, limit=30)
page2 = shop.products_page(page=2, limit=30)

# Same for collection products
all_power_banks = shop.collection_products('power-banks')
first_page = shop.collection_products_page('power-banks', page=1, limit=10)

Exporting

from shopifyscrape import Exporter, Shopify

shop = Shopify('spharetech.com')
products = shop.products()

exporter = Exporter(output_dir='output')
exporter.products_to_json(products)
exporter.products_to_csv(products)

Proxy Support

shop = Shopify('store.com', proxy='http://user:pass@host:port')

CLI

# Scrape products
shopifyscrape products spharetech.com
shopifyscrape products spharetech.com --collection power-banks
shopifyscrape products spharetech.com --json
shopifyscrape products spharetech.com --save products.csv

# Scrape collections
shopifyscrape collections spharetech.com

# Store metadata
shopifyscrape store spharetech.com

# With proxy
shopifyscrape --proxy http://host:port products spharetech.com

REST API

# Start the API server
shopifyscrape serve
shopifyscrape serve --port 3000

Endpoints

Method Endpoint Description
GET /api/v1/products?domain=store.com All products
GET /api/v1/products?domain=store.com&collection=power-banks Collection products
GET /api/v1/products/{handle}?domain=store.com Single product
GET /api/v1/collections?domain=store.com All collections
GET /api/v1/store?domain=store.com Store metadata
GET /api/v1/pages?domain=store.com All pages
GET /health Health check

Interactive docs at http://localhost:8000/docs

Error Handling

from shopifyscrape import Shopify, StoreNotFoundError, ProductNotFoundError

shop = Shopify('not-a-shopify-store.com')
try:
    store = shop.store()
except StoreNotFoundError:
    print('Not a Shopify store')

try:
    product = shop.product('nonexistent')
except ProductNotFoundError:
    print('Product not found')

Exception Hierarchy

ShopifyError
├── StoreNotFoundError
├── ProductNotFoundError
├── CollectionNotFoundError
├── PageNotFoundError
├── RateLimitError
├── RequestError
└── ParsingError

Data Models

Model Description
Store Store metadata (name, currency, counts)
Product Product with variants, images, options
Variant Pricing, stock, SKU, weight
ProductImage Image URL with dimensions
ProductOption Option name and values
Collection Collection with image and product count
Page Static page content

All models have a .to_dict() method for serialization.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shopscout-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shopscout-0.1.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file shopscout-0.1.0.tar.gz.

File metadata

  • Download URL: shopscout-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for shopscout-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f039553f30d1e8ff58d9d6478c28b398cd49f888cf32cf1b57a776b8cb858ad
MD5 540b9ac5ea854f2c09c5b7fdf53eaedf
BLAKE2b-256 c8993e7b63a76c49b69246c237f8ef7b4f207e21b49855451d676656a0af7603

See more details on using hashes here.

File details

Details for the file shopscout-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: shopscout-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for shopscout-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0050bbf7b7c5f17d1a3b975e6744f66e1c180e4032a00e45fa4b826ab8f45b98
MD5 fae4656f890f42a8cb000db54d871d0a
BLAKE2b-256 c569ac16d58b792a8920577cb30852afb74be8faff00eb143127d6b491f07656

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page