diff --git a/src/keepa/interface.py b/src/keepa/interface.py index 4041e56..8ac636e 100644 --- a/src/keepa/interface.py +++ b/src/keepa/interface.py @@ -630,17 +630,17 @@ def query( active. raw : bool, default; False - When ``True``, return the raw request response. This is - only available in the non-async class. + When ``True``, return the raw request response. This is only + available in the non-async class. videos : bool, optional Token Cost: No extra token cost - Boolean value (0 = false, 1 = true). If specified and set to 1, the - videos metadata will be provided when available. Using this - parameter does not trigger an update to the videos data; it only - gives access to our existing data if available. If you need - up-to-date data, you have to use the offers parameter. + If ``True``, the videos metadata will be provided when + available. Using this parameter does not trigger an update to the + videos data; it only gives access to our existing data if + available. If you need up-to-date data, you have to use the offers + parameter. Returns ------- @@ -826,6 +826,14 @@ def query( 118 2023-10-27 08:14:00 A1U9HDFCZO1A84 Used - Like New False 119 2023-10-27 12:34:00 AYUGEV9WZ4X5O Used - Like New False + Query a video with the "videos" metadata. + + >>> response = api.query("B00UFMKSDW", history=False, videos=True) + >>> product = response[0] + >>> "videos" in product + True + + """ # Format items into numpy array try: @@ -1767,6 +1775,7 @@ async def query( days: Optional[int] = None, only_live_offers: Optional[bool] = None, raw: bool = False, + videos: bool = False, ): """Documented in Keepa.query.""" if raw: diff --git a/tests/test_interface.py b/tests/test_interface.py index b42af31..9cc8c4d 100644 --- a/tests/test_interface.py +++ b/tests/test_interface.py @@ -33,6 +33,7 @@ # just need an active product with a buybox PRODUCT_ASIN = "0593440412" HARD_DRIVE_PRODUCT_ASIN = "B0088PUEPK" +VIDEO_ASIN = "B0060CU5DE" # ASINs of a bunch of chairs generated with # categories = API.search_for_categories('chairs') @@ -422,3 +423,14 @@ def test_seller_query_long_list(api): seller_id = ["A2L77EE7U53NWQ"] * 200 with pytest.raises(RuntimeError): api.seller_query(seller_id) + + +def test_video_query(api) -> None: + """Test if the videos query parameter works.""" + response = api.query("B00UFMKSDW", history=False, videos=False) + product = response[0] + assert "videos" not in product + + response = api.query("B00UFMKSDW", history=False, videos=True) + product = response[0] + assert "videos" in product