Skip to main content

scrapelyserp

The official Python SDK for the Scrapely API: product, price and stock data from the retailers you sell on, structured search results, and watchlists that alert you when something changes.

  • Every API operation, generated from the API's OpenAPI document, grouped by resource.
  • Sync (Scrapely) and asyncio (AsyncScrapely) clients over httpx, the only dependency. Python 3.9+.
  • Typed: request and response bodies are TypedDicts (scrapelyserp.types), methods have typed signatures.
  • Retries with backoff on 429 and 5xx, honouring Retry-After; idempotency keys generated for you.
  • Typed errors carrying the API's error code and param.
pip install scrapelyserp

Quick start

from scrapelyserp import Scrapely

client = Scrapely()  # reads SCRAPELY_API_KEY

account = client.account.get()
print(account["balance"], "credits")

products = client.products.fetch(platform="amazon", ids=["B0009KNLV6"], tier="lite")
for item in products["results"]:
    print(item["id"], item["status"], item.get("price"))

# Structured endpoints are grouped by platform.
results = client.structured.amazon.search(query="wireless earbuds")
posts = client.structured.reddit.posts(subreddit="deals")

Async:

import asyncio
from scrapelyserp import AsyncScrapely

async def main() -> None:
    async with AsyncScrapely() as client:
        account = await client.account.get()
        async for item in client.watchlists.list_items_iter("wl_…"):
            print(item["id"])

asyncio.run(main())

Configuration

client = Scrapely(
    api_key="sk_live_…",                   # default: SCRAPELY_API_KEY
    base_url="https://scrapelyserp.com",   # default: SCRAPELY_BASE_URL, then this
    max_retries=2,                         # 429, 5xx (except 501) and network errors
    timeout=360.0,                         # seconds per attempt
    headers={"x-my-header": "1"},
    http_client=httpx.Client(...),         # your own httpx client (proxies, transports, tests)
)

Use it as a context manager (with Scrapely() as client:) or call client.close().

Resources

client.products, client.offers, client.platforms, client.structured (one sub-resource per platform: client.structured.ebay.image_search(...)), client.watchlists, client.destinations, client.webhook_endpoints, client.s3_export, client.account, client.meta.

Path parameters are positional; query parameters are keyword arguments; a body is a dict, keyword arguments, or both (keywords win):

wl = client.watchlists.create(name="Consoles", platform="target", ids=["83887639"], every="15m")
client.watchlists.update(wl["id"], status="paused")
page = client.watchlists.list_items(wl["id"], state="active", limit=100)
client.destinations.set_for_watchlist(wl["id"], destinations=[])

# Any operation by its OpenAPI operationId:
client.request("getWatchlist", path={"id": wl["id"]})

Every method also takes options={"headers": ..., "timeout": ..., "max_retries": ...}.

Pagination

List operations with a starting_after cursor have an ..._iter twin that walks every page:

for item in client.watchlists.list_items_iter("wl_…", changed_since="2026-11-01T00:00:00Z"):
    print(item["id"], item.get("snapshot"))

Errors

Every error is a ScrapelyError. API answers are an APIError subclass with status, code (stable: branch on it), message, param, docs and request_id:

from scrapelyserp import APIError, InsufficientCreditsError

try:
    client.products.fetch(platform="walmart", ids=["5689919121"])
except InsufficientCreditsError:
    print("Top up first")
except APIError as e:
    print(e.code, e.param, e.request_id)

BadRequestError (400), AuthenticationError (401), InsufficientCreditsError (402), PermissionDeniedError (403), NotFoundError (404), ConflictError (409), RateLimitError (429), InternalServerError (5xx), ComingSoonError (501: announced, not live yet; nothing charged), APIConnectionError / APITimeoutError (no answer).

Retries and idempotency

429 and 5xx answers (except 501) and network errors are retried max_retries times, waiting for Retry-After when the API sends it, else 0.5 s, 1 s, 2 s... Operations that accept an Idempotency-Key (creating a watchlist) get one generated per call and reused across its retries; pass idempotency_key= to choose your own.

Development

types.py, _routes.py and _resources.py are generated from the API's OpenAPI document by scripts/sdk/generate.ts in the Scrapely repository; do not edit them by hand.

python -m unittest discover -s tests   # offline, against httpx.MockTransport
python -m build                        # sdist + wheel

License

MIT

Metadata

Release files for scrapelyserp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scrapelyserp 0.2.0
File Size Uploaded Provenance Actions
scrapelyserp-0.2.0.tar.gz 119.5 kB Without provenance Details for scrapelyserp-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scrapelyserp 0.2.0
File Interpreter ABI Platform Actions
scrapelyserp-0.2.0-py3-none-any.whl Python 3 none any Details for scrapelyserp-0.2.0-py3-none-any.whl

Total release size: 239.8 kB

Release files / scrapelyserp-0.2.0.tar.gz

Download URL scrapelyserp-0.2.0.tar.gz
Size 119.5 kB
Tags Source
SHA-256 checksum
How to use checksums
832062d9fac2f314d849c2afa768db4811b766e4da409baa23ac542cd74adcb7
BLAKE2b-256 checksum
How to use checksums
da734dc8b1f5318cfc0211e4db72b56724bac6bb4c23eecfea2b6f49cc9ee031
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / scrapelyserp-0.2.0-py3-none-any.whl

Download URL scrapelyserp-0.2.0-py3-none-any.whl
Size 120.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa653fb3f8fdf12954833e5a427c7570e628c69fb73046aed59cdc61203a27ce
BLAKE2b-256 checksum
How to use checksums
d6ece7a30f562cf6cb141465853e131ebf4cb87d5a67342233fe461b1a0e9fc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for scrapelyserp 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page