keepa.AsyncKeepa.download_graph_image#

async AsyncKeepa.download_graph_image(asin: str, filename: str | Path, domain: str | Domain = 'US', wait: bool = True, **graph_kwargs: dict[str, Any]) None#

Download the graph image of an ASIN from keepa.

See Graph Image API for more details.

Parameters:
asinstr

The ASIN of the product.

filenamestr | pathlib.Path

Path to save the png to.

domainstr | keepa.Domain, default: ‘US’

A valid Amazon domain. See keepa.Domain.

waitbool, default: True

Wait for available tokens before querying the keepa backend.

**graph_kwargsdict[str, Any], optional

Optional graph keyword arguments. See Graph Image API for more details.

Notes

Graph images are cached for 90 minutes on a per-user basis. The cache invalidates if any parameter changes. Submitting the exact same request within this time frame will not consume any tokens.

Examples

Download a keepa graph image showing the current Amazon price, new price, and the sales rank of a product with ASIN "B09YNQCQKR".

>>> from keepa import Keepa
>>> api = Keepa("<YOUR_API_KEY>")
>>> api.download_graph_image(
...     asin="B09YNQCQKR",
...     filename="product_graph.png",
...     amazon=1,
...     new=1,
...     salesrank=1,
... )

Show Amazon price, new and used graphs, buy box and FBA, for last 365 days, with custom width/height and custom colors. See Graph Image API for more details.

>>> api.download_graph_image(
...     asin="B09YNQCQKR",
...     filename="product_graph_365.png",
...     domain="US",
...     amazon=1,
...     new=1,
...     used=1,
...     bb=1,
...     fba=1,
...     range=365,
...     width=800,
...     height=400,
...     cBackground="ffffff",
...     cAmazon="FFA500",
...     cNew="8888dd",
...     cUsed="444444",
...     cBB="ff00b4",
...     cFBA="ff5722",
... )