akaszynski / keepa

Python Keepa.com API
https://keepaapi.readthedocs.io/en/latest/
Apache License 2.0
241 stars 77 forks source link

api.search_for_categories() #118

Open ahsantfw opened 2 years ago

ahsantfw commented 2 years ago

I want to get "category numbers" for the Main Categories Like Home&Kitchen etc (Categories with most sales) but I don't know how to use this function as it takes "search word" and returns subcategories.

print(Initializing Keepa API\n')
api = keepa.Keepa(mykey)
categories = api.search_for_categories()
print(categories)

image

akaszynski commented 1 year ago

If I understand you right, I think you're looking for something like:

Query for the best sellers among the ``"movies"`` category.

>>> import keepa
>>> key = '<REAL_KEEPA_KEY>'
>>> api = keepa.Keepa(key)
>>> categories = api.search_for_categories("movies")
>>> category = list(categories.items())[0][0]
>>> asins = api.best_sellers_query(category)
>>> asins
['B0BF3P5XZS',
 'B08JQN5VDT',
 'B09SP8JPPK',
 '0999296345',
 'B07HPG684T',
 '1984825577',
...