Skip to main content

chocodata

Official Python SDK for the Chocodata web scraping API.

Typed methods for the endpoints most people start with, a generic client for the rest of the catalog, retry with backoff, and a structured error type. No dependencies: standard library only.

pip install chocodata

Python 3.9+.

Quick start

from chocodata import Chocodata

chocodata = Chocodata("asa_live_YOUR_KEY")

product = chocodata.amazon.product(query="0143127748")
print(product["title"], product["price"])

Get a key at chocodata.com. The free tier is 1,000 requests, one time, no card.

Authentication

The key travels as a query parameter, which the SDK handles for you. There is no header auth: sending Authorization: Bearer or X-API-Key returns 401.

Endpoints

Every method below was smoke-tested against production before release.

# Ecommerce
chocodata.amazon.product(query="0143127748")               # ASIN or ISBN
chocodata.amazon.product(query="0143127748", domain="de")  # prices localise to the marketplace
chocodata.amazon.search(query="laptop")

chocodata.walmart.product(url="https://www.walmart.com/ip/19075520026")
chocodata.walmart.search(query="laptop")

chocodata.ebay.product(url="https://www.ebay.com/itm/298520538688")
chocodata.ebay.search(query="laptop")

# Search engines  (note: Bing takes `q`, not `query`)
chocodata.bing.search(q="coffee", count=10)
chocodata.bing.images(q="red panda", count=20, safe_search="strict")

# Social / video
chocodata.tiktok.profile(username="rotana")
chocodata.youtube.video(video_id="dQw4w9WgXcQ")
chocodata.instagram.profile(username="nasa")

Parameters are not uniform across targets, and the SDK does not pretend otherwise. amazon.product takes query; walmart.product takes url or id and rejects query; bing.search takes q.

Everything else

The catalog has 499 endpoints. Anything without a dedicated method is reachable through the same code path:

chocodata.scrape("bing", "videos", {"q": "coffee"})
chocodata.scrape("reddit", "post", {"post_id": "627akk", "subreddit": "askscience"})

Errors

from chocodata import Chocodata, ChocodataError

try:
    chocodata.tiktok.profile(username="a-handle-that-is-gone")
except ChocodataError as e:
    print(e.status)      # 404
    print(e.code)        # 'item_not_found'
    print(e.retryable)   # False
    print(e.request_id)  # for support
Status Code Meaning
400 invalid_params A required parameter is missing or the wrong type. The body names it.
401 INVALID_API_KEY Key missing, unrecognised, or revoked.
402 INSUFFICIENT_CREDITS Balance exhausted.
404 item_not_found The item genuinely does not exist. Not retryable.
429 RATE_LIMITED Over 120 requests / 60s, or over your plan's concurrency.
502 extraction_failed / target_unreachable Retryable; the SDK already retried.

You are only charged on a 2xx. Errors cost no credits.

Retries

Retryable failures (429, 5xx, network) are retried with exponential backoff plus jitter. The SDK trusts the server's retryable flag, so a 404 is never retried.

chocodata = Chocodata(
    "asa_live_YOUR_KEY",
    max_retries=3,   # default 2
    timeout=120.0,   # default 90.0
    debug=True,      # log every call
)

Concurrency

AsyncChocodata runs each request in a worker thread via asyncio.to_thread, so it composes with asyncio.gather. It is a concurrency wrapper, not a native async HTTP stack.

import asyncio
from chocodata import AsyncChocodata

async def main():
    client = AsyncChocodata("asa_live_YOUR_KEY")
    asins = ["0143127748", "B09B8V1LZ3", "B0BSHF7WHW"]
    results = await asyncio.gather(*[
        client.ascrape("amazon", "product", {"query": a}) for a in asins
    ])
    for r in results:
        print(r["asin"], r.get("title"))

asyncio.run(main())

Requests are limited to 120 per key per 60 seconds, plus a per-plan concurrency ceiling.

License

MIT

Metadata

Release files for chocodata 0.1.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 chocodata 0.1.0
File Size Uploaded Provenance Actions
chocodata-0.1.0.tar.gz 6.4 kB Without provenance Details for chocodata-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 13.6 kB

Release files / chocodata-0.1.0.tar.gz

Download URL chocodata-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
db1b876921167f9947a76439ebb2328a7bcc0774d4c7eb7100c821574c75e21a
BLAKE2b-256 checksum
How to use checksums
37e7a406b3d1816c1fa46b9d06e07172f28b5afe7eabd1e20917ac4aa3843a5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / chocodata-0.1.0-py3-none-any.whl

Download URL chocodata-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7662decd37164f2e7baa600a070343c26f14be90713c793ecb95793f69ef153
BLAKE2b-256 checksum
How to use checksums
02be458bc67a7854c6cb5056dc53361926a80cb9d4079a9c5eb5fbe4dfa8ce24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for chocodata 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.

Release history Release notifications | RSS feed

This release

0.1.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