Skip to main content

DataGuru Python SDK

The official Python client for DataGuru. DataGuru turns websites like Amazon, Walmart, Google, TikTok and 1688 into JSON APIs.

pip install dataguru-sdk
from dataguru import DataGuru

dg = DataGuru(api_key="YOUR_API_KEY")  # or set DATAGURU_API_KEY

product = dg.call(
    "amazon-products-search",
    product_url="https://www.amazon.com/dp/B0CHWRXH8B",
)
print(product["title"], product["price"])

Get an API key from the dashboard. Each call is billed to your balance at the API's listed price. You can browse every API, with its parameters and price, at dataguru.cc/apis.

Find an API

The catalog is public, so these calls don't need a key.

for api in dg.apis.search("walmart"):
    print(api["slug"], api["pricing"]["customer_price"], [p["name"] for p in api["parameters"]])

details = dg.apis.get("amazon-products-search")   # parameters, pricing, limits, sample_response, docs_url
everything = dg.apis.list(category="E-Commerce")

dg.call() takes an API's slug (amazon-products-search) or its endpoint path (amazon/products/search). You can pass parameters as keyword arguments or as a dict. The client checks them against the API's declared parameters before it sends anything.

Async jobs

Use a job when you don't want to hold a connection open for a slow scrape. Funds are held when you submit and charged only if the job succeeds.

job = dg.jobs.submit("amazon-products-search", {"product_url": "https://www.amazon.com/dp/B0CHWRXH8B"})
data = dg.jobs.wait(job["job_id"])        # polls; raises JobFailedError if it fails

data = dg.jobs.run("amazon-products-search", product_url="...")   # submit + wait

Batches

Upload a CSV with one request per row. Its columns are the API's parameter names.

batch = dg.batches.create("amazon-products-search", "products.csv")
dg.batches.wait(batch["batch_id"])                      # or poll dg.batches.get(...)["progress"]

for row in dg.batches.iter_results(batch["batch_id"]):  # streams JSON Lines
    print(row["status"], row.get("data"))

dg.batches.download(batch["batch_id"], "results.csv")   # json, jsonl or csv summary
dg.batches.cancel(batch["batch_id"])                    # unstarted rows are refunded

Errors

Every error inherits from dataguru.DataGuruError. HTTP errors are APIError subclasses with status_code, code, message, details and request_id:

Exception When
ValidationError 400: a parameter is missing or invalid (see .details)
AuthenticationError 401/403: the key is missing, invalid or revoked
InsufficientBalanceError 402: your balance is too low, so top up
NotFoundError 404
RateLimitError 429: .retry_after gives the wait in seconds
ServerError 5xx
JobFailedError an async job failed (failed jobs are not billed)
from dataguru import DataGuru, InsufficientBalanceError, ValidationError

try:
    dg.call("amazon-products-search", product_url="not a url")
except ValidationError as e:
    print(e.details)

The client retries read requests (catalog lookups, job and batch status) on 429, 5xx and connection errors. A billed request is retried only when nothing ran: the connection failed before it was sent, or DataGuru's rate limiter turned it away (the client waits for Retry-After, up to 60 s). A retry never charges you twice. A 429 passed through from the target site is raised as RateLimitError and is not retried.

Configuration

DataGuru(
    api_key=None,       # default: $DATAGURU_API_KEY
    base_url=None,      # default: $DATAGURU_BASE_URL or https://api.dataguru.cc
    timeout=120.0,      # seconds per HTTP response
    max_retries=2,
)

DataGuru can be used as a context manager (with DataGuru() as dg: ...) and closes its connection pool on exit.

Requires Python 3.9+. Released under the MIT license.

Metadata

Release files for dataguru-sdk 0.1.1

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

Source distribution (sdist)

Source distribution for dataguru-sdk 0.1.1
File Size Uploaded Provenance Actions
dataguru_sdk-0.1.1.tar.gz 13.8 kB Without provenance Details for dataguru_sdk-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dataguru-sdk 0.1.1
File Interpreter ABI Platform Actions
dataguru_sdk-0.1.1-py3-none-any.whl Python 3 none any Details for dataguru_sdk-0.1.1-py3-none-any.whl

Total release size: 27.4 kB

Release files / dataguru_sdk-0.1.1.tar.gz

Download URL dataguru_sdk-0.1.1.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3ece64e25ad262681d65c11a2d53994d8ee3384e04de480c0ebf1acc5b848b5f
BLAKE2b-256 checksum
How to use checksums
03adbfc7d32f85405c8cdce1958b64bbe40fccfd2a16118130c56a3d1017b684
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / dataguru_sdk-0.1.1-py3-none-any.whl

Download URL dataguru_sdk-0.1.1-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc2fd6b2ff800dd7fef8e56ac9c7a33e8d10a8e5f9851e66945878f0b0bc1800
BLAKE2b-256 checksum
How to use checksums
a14aa8d0c60e83eb31c254e8f2f6734dfa481050adfed1307fe89ae6b30fe854
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for dataguru-sdk 0.1.1

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.

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