keepa.Keepa.product_finder#

Keepa.product_finder(product_parms: dict[str, Any] | ProductFinderRequest | ProductParams, domain: str | Domain = 'US', wait: bool = True, n_products: int = 50) list[str]#

Query the keepa product database to find products matching criteria.

Almost all product fields can be searched for and sorted.

Parameters:
product_parmsdict, ProductParams, ProductFinderRequest

Dictionary, keepa.ProductParams, or generated keepa.models.backend.ProductFinderRequest.

domainstr | keepa.Domain, default: ‘US’

A valid Amazon domain. See keepa.Domain.

waitbool, default: True

Wait for available tokens before querying the keepa backend.

n_productsint, default: 50

Maximum number of matching products returned by keepa. This can be overridden by the ‘perPage’ key in product_parms.

Returns:
list[str]

List of ASINs matching the product parameters.

Notes

When using the 'sort' key in the product_parms parameter, use a list of [field, direction] pairs. For example: [["current_SALES", "asc"]]

Examples

Query for the first 100 of Jim Butcher’s books using the synchronous keepa.Keepa class. Sort by current sales.

>>> import keepa
>>> api = keepa.Keepa("<ENTER_ACTUAL_KEY_HERE>")
>>> product_parms = {
...     "author": "jim butcher",
...     "sort": [["current_SALES", "asc"]],
... }
>>> asins = api.product_finder(product_parms, n_products=100)
>>> asins
['B000HRMAR2',
 '0578799790',
 'B07PW1SVHM',
...
 'B003MXM744',
 '0133235750',
 'B01MXXLJPZ']

Alternatively, use the keepa.ProductParams:

>>> product_parms = keepa.ProductParams(
...     author="jim butcher",
...     sort=[["current_SALES", "asc"]],
... )
>>> asins = api.product_finder(product_parms, n_products=100)

Query for all of Jim Butcher’s books using the asynchronous keepa.AsyncKeepa class.

>>> import asyncio
>>> import keepa
>>> product_parms = {"author": "jim butcher"}
>>> async def main():
...     key = "<REAL_KEEPA_KEY>"
...     api = await keepa.AsyncKeepa.create(key)
...     return await api.product_finder(product_parms)
...
>>> asins = asyncio.run(main())
>>> asins
['B000HRMAR2',
 '0578799790',
 'B07PW1SVHM',
...
 'B003MXM744',
 '0133235750',
 'B01MXXLJPZ']