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
codeandparam.
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.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapelyserp-0.1.0.tar.gz | 117.9 kB | Without provenance | Details for scrapelyserp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapelyserp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for scrapelyserp-0.1.0-py3-none-any.whl |
Total release size: 236.5 kB
Release files / scrapelyserp-0.1.0.tar.gz
| Download URL | scrapelyserp-0.1.0.tar.gz |
|---|---|
| Size | 117.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
179df89413938ec2de733db883325ec34165095ad396051402c7bdf46f7eef7f
|
|
BLAKE2b-256 checksum How to use checksums |
e97596c5d1f02569838895c6ca3f69762955ed1b5463de832ca839a266cfe662
|
| 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.1.0-py3-none-any.whl
| Download URL | scrapelyserp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 118.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f79e021e2ba9ad154c69f32dffba45b1a04b26f85c6d155eef328d47f4cf289
|
|
BLAKE2b-256 checksum How to use checksums |
72b7fd46e475fe5fae755be3ec59b7ada831d609851c44afb82b171bdbab10c9
|
| 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.1.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.