keepa 1.3.7__tar.gz → 1.3.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {keepa-1.3.7 → keepa-1.3.8}/PKG-INFO +1 -1
- {keepa-1.3.7 → keepa-1.3.8}/pyproject.toml +8 -4
- {keepa-1.3.7 → keepa-1.3.8}/src/keepa/__init__.py +6 -1
- {keepa-1.3.7 → keepa-1.3.8}/src/keepa/interface.py +49 -49
- {keepa-1.3.7 → keepa-1.3.8}/README.rst +0 -0
- {keepa-1.3.7 → keepa-1.3.8}/src/keepa/plotting.py +0 -0
- {keepa-1.3.7 → keepa-1.3.8}/src/keepa/query_keys.py +0 -0
|
@@ -59,8 +59,12 @@ force_sort_within_sections = true
|
|
|
59
59
|
# Combines "as" imports on the same line
|
|
60
60
|
combine_as_imports = true
|
|
61
61
|
|
|
62
|
-
[tool.
|
|
62
|
+
[tool.ruff]
|
|
63
63
|
line-length = 100
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
|
|
65
|
+
[tool.ruff.lint]
|
|
66
|
+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
|
67
|
+
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
|
68
|
+
# McCabe complexity (`C901`) by default.
|
|
69
|
+
select = ["E4", "E7", "E9", "F"]
|
|
70
|
+
ignore = []
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"""Keepaapi module."""
|
|
2
2
|
|
|
3
|
-
__version__ = "1.3.
|
|
3
|
+
__version__ = "1.3.8"
|
|
4
4
|
from keepa.interface import ( # noqa: F401
|
|
5
|
+
DCODES,
|
|
6
|
+
KEEPA_ST_ORDINAL,
|
|
7
|
+
SCODES,
|
|
5
8
|
AsyncKeepa,
|
|
6
9
|
Keepa,
|
|
7
10
|
convert_offer_history,
|
|
11
|
+
csv_indices,
|
|
8
12
|
format_items,
|
|
9
13
|
keepa_minutes_to_time,
|
|
14
|
+
parse_csv,
|
|
10
15
|
process_used_buybox,
|
|
11
16
|
run_and_get,
|
|
12
17
|
)
|
|
@@ -364,28 +364,28 @@ class Keepa:
|
|
|
364
364
|
Create the api object.
|
|
365
365
|
|
|
366
366
|
>>> import keepa
|
|
367
|
-
>>> key =
|
|
367
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
368
368
|
>>> api = keepa.Keepa(key)
|
|
369
369
|
|
|
370
370
|
Request data from two ASINs.
|
|
371
371
|
|
|
372
|
-
>>> products = api.query([
|
|
372
|
+
>>> products = api.query(["0439064872", "1426208081"])
|
|
373
373
|
|
|
374
374
|
Print item details.
|
|
375
375
|
|
|
376
|
-
>>> print(
|
|
377
|
-
>>> print(
|
|
378
|
-
>>> print(
|
|
376
|
+
>>> print("Item 1")
|
|
377
|
+
>>> print("\t ASIN: {:s}".format(products[0]["asin"]))
|
|
378
|
+
>>> print("\t Title: {:s}".format(products[0]["title"]))
|
|
379
379
|
Item 1
|
|
380
380
|
ASIN: 0439064872
|
|
381
381
|
Title: Harry Potter and the Chamber of Secrets (2)
|
|
382
382
|
|
|
383
383
|
Print item price.
|
|
384
384
|
|
|
385
|
-
>>> usedprice = products[0][
|
|
386
|
-
>>> usedtimes = products[0][
|
|
387
|
-
>>> print(
|
|
388
|
-
>>> print(
|
|
385
|
+
>>> usedprice = products[0]["data"]["USED"]
|
|
386
|
+
>>> usedtimes = products[0]["data"]["USED_time"]
|
|
387
|
+
>>> print("\t Used price: ${:.2f}".format(usedprice[-1]))
|
|
388
|
+
>>> print("\t as of: {:s}".format(str(usedtimes[-1])))
|
|
389
389
|
Used price: $0.52
|
|
390
390
|
as of: 2023-01-03 04:46:00
|
|
391
391
|
|
|
@@ -418,7 +418,7 @@ class Keepa:
|
|
|
418
418
|
should be 0.0 seconds.
|
|
419
419
|
|
|
420
420
|
>>> import keepa
|
|
421
|
-
>>> key =
|
|
421
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
422
422
|
>>> api = keepa.Keepa(key)
|
|
423
423
|
>>> api.time_to_refill
|
|
424
424
|
0.0
|
|
@@ -738,10 +738,10 @@ class Keepa:
|
|
|
738
738
|
keepa interface.
|
|
739
739
|
|
|
740
740
|
>>> import keepa
|
|
741
|
-
>>> key =
|
|
741
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
742
742
|
>>> api = keepa.Keepa(key)
|
|
743
|
-
>>> response = api.query(
|
|
744
|
-
>>> response[0][
|
|
743
|
+
>>> response = api.query("B0088PUEPK")
|
|
744
|
+
>>> response[0]["title"]
|
|
745
745
|
'Western Digital 1TB WD Blue PC Internal Hard Drive HDD - 7200 RPM,
|
|
746
746
|
SATA 6 Gb/s, 64 MB Cache, 3.5" - WD10EZEX'
|
|
747
747
|
|
|
@@ -751,12 +751,12 @@ class Keepa:
|
|
|
751
751
|
>>> import asyncio
|
|
752
752
|
>>> import keepa
|
|
753
753
|
>>> async def main():
|
|
754
|
-
... key =
|
|
754
|
+
... key = "<REAL_KEEPA_KEY>"
|
|
755
755
|
... api = await keepa.AsyncKeepa().create(key)
|
|
756
|
-
... return await api.query(
|
|
756
|
+
... return await api.query("B0088PUEPK")
|
|
757
757
|
...
|
|
758
758
|
>>> response = asyncio.run(main())
|
|
759
|
-
>>> response[0][
|
|
759
|
+
>>> response[0]["title"]
|
|
760
760
|
'Western Digital 1TB WD Blue PC Internal Hard Drive HDD - 7200 RPM,
|
|
761
761
|
SATA 6 Gb/s, 64 MB Cache, 3.5" - WD10EZEX'
|
|
762
762
|
|
|
@@ -764,11 +764,11 @@ class Keepa:
|
|
|
764
764
|
``pandas.DataFrame``.
|
|
765
765
|
|
|
766
766
|
>>> import keepa
|
|
767
|
-
>>> key =
|
|
767
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
768
768
|
>>> api = keepa.Keepa(key)
|
|
769
|
-
>>> response = api.query(
|
|
769
|
+
>>> response = api.query("B0088PUEPK", offers=20)
|
|
770
770
|
>>> product = response[0]
|
|
771
|
-
>>> buybox_info = product[
|
|
771
|
+
>>> buybox_info = product["buyBoxUsedHistory"]
|
|
772
772
|
>>> df = keepa.process_used_buybox(buybox_info)
|
|
773
773
|
datetime user_id condition isFBA
|
|
774
774
|
0 2022-11-02 16:46:00 A1QUAC68EAM09F Used - Like New True
|
|
@@ -1040,7 +1040,7 @@ class Keepa:
|
|
|
1040
1040
|
Query for the best sellers among the ``"movies"`` category.
|
|
1041
1041
|
|
|
1042
1042
|
>>> import keepa
|
|
1043
|
-
>>> key =
|
|
1043
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
1044
1044
|
>>> api = keepa.Keepa(key)
|
|
1045
1045
|
>>> categories = api.search_for_categories("movies")
|
|
1046
1046
|
>>> category = list(categories.items())[0][0]
|
|
@@ -1060,7 +1060,7 @@ class Keepa:
|
|
|
1060
1060
|
>>> import asyncio
|
|
1061
1061
|
>>> import keepa
|
|
1062
1062
|
>>> async def main():
|
|
1063
|
-
... key =
|
|
1063
|
+
... key = "<REAL_KEEPA_KEY>"
|
|
1064
1064
|
... api = await keepa.AsyncKeepa().create(key)
|
|
1065
1065
|
... categories = await api.search_for_categories("movies")
|
|
1066
1066
|
... category = list(categories.items())[0][0]
|
|
@@ -1120,11 +1120,11 @@ class Keepa:
|
|
|
1120
1120
|
Print all categories from science.
|
|
1121
1121
|
|
|
1122
1122
|
>>> import keepa
|
|
1123
|
-
>>> key =
|
|
1123
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
1124
1124
|
>>> api = keepa.Keepa(key)
|
|
1125
|
-
>>> categories = api.search_for_categories(
|
|
1125
|
+
>>> categories = api.search_for_categories("science")
|
|
1126
1126
|
>>> for cat_id in categories:
|
|
1127
|
-
... print(cat_id, categories[cat_id][
|
|
1127
|
+
... print(cat_id, categories[cat_id]["name"])
|
|
1128
1128
|
...
|
|
1129
1129
|
9091159011 Behavioral Sciences
|
|
1130
1130
|
8407535011 Fantasy, Horror & Science Fiction
|
|
@@ -1182,7 +1182,7 @@ class Keepa:
|
|
|
1182
1182
|
Use 0 to return all root categories.
|
|
1183
1183
|
|
|
1184
1184
|
>>> import keepa
|
|
1185
|
-
>>> key =
|
|
1185
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
1186
1186
|
>>> api = keepa.Keepa(key)
|
|
1187
1187
|
>>> categories = api.category_lookup(0)
|
|
1188
1188
|
|
|
@@ -1300,10 +1300,10 @@ class Keepa:
|
|
|
1300
1300
|
Return the information from seller ``'A2L77EE7U53NWQ'``.
|
|
1301
1301
|
|
|
1302
1302
|
>>> import keepa
|
|
1303
|
-
>>> key =
|
|
1303
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
1304
1304
|
>>> api = keepa.Keepa(key)
|
|
1305
|
-
>>> seller_info = api.seller_query(
|
|
1306
|
-
>>> seller_info[
|
|
1305
|
+
>>> seller_info = api.seller_query("A2L77EE7U53NWQ", "US")
|
|
1306
|
+
>>> seller_info["A2L77EE7U53NWQ"]["sellerName"]
|
|
1307
1307
|
'Amazon Warehouse'
|
|
1308
1308
|
|
|
1309
1309
|
Notes
|
|
@@ -2376,10 +2376,10 @@ class Keepa:
|
|
|
2376
2376
|
``keepa.Keepa`` class. Sort by current sales.
|
|
2377
2377
|
|
|
2378
2378
|
>>> import keepa
|
|
2379
|
-
>>> api = keepa.Keepa(
|
|
2379
|
+
>>> api = keepa.Keepa("<ENTER_ACTUAL_KEY_HERE>")
|
|
2380
2380
|
>>> product_parms = {
|
|
2381
|
-
...
|
|
2382
|
-
...
|
|
2381
|
+
... "author": "jim butcher",
|
|
2382
|
+
... "sort": ["current_SALES", "asc"],
|
|
2383
2383
|
... }
|
|
2384
2384
|
>>> asins = api.product_finder(product_parms, n_products=100)
|
|
2385
2385
|
>>> asins
|
|
@@ -2396,9 +2396,9 @@ class Keepa:
|
|
|
2396
2396
|
|
|
2397
2397
|
>>> import asyncio
|
|
2398
2398
|
>>> import keepa
|
|
2399
|
-
>>> product_parms = {
|
|
2399
|
+
>>> product_parms = {"author": "jim butcher"}
|
|
2400
2400
|
>>> async def main():
|
|
2401
|
-
... key =
|
|
2401
|
+
... key = "<REAL_KEEPA_KEY>"
|
|
2402
2402
|
... api = await keepa.AsyncKeepa().create(key)
|
|
2403
2403
|
... return await api.product_finder(product_parms)
|
|
2404
2404
|
...
|
|
@@ -2425,7 +2425,7 @@ class Keepa:
|
|
|
2425
2425
|
payload = {
|
|
2426
2426
|
"key": self.accesskey,
|
|
2427
2427
|
"domain": DCODES.index(domain),
|
|
2428
|
-
"selection": json.dumps({**product_parms, **{
|
|
2428
|
+
"selection": json.dumps({**product_parms, **{"perPage": n_products}}),
|
|
2429
2429
|
}
|
|
2430
2430
|
|
|
2431
2431
|
response = self._request("query", payload, wait=wait)
|
|
@@ -2496,7 +2496,7 @@ class Keepa:
|
|
|
2496
2496
|
``keepa.Keepa`` class
|
|
2497
2497
|
|
|
2498
2498
|
>>> import keepa
|
|
2499
|
-
>>> key =
|
|
2499
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
2500
2500
|
>>> api = keepa.Keepa(key)
|
|
2501
2501
|
>>> deal_parms = {
|
|
2502
2502
|
... "page": 0,
|
|
@@ -2508,7 +2508,7 @@ class Keepa:
|
|
|
2508
2508
|
|
|
2509
2509
|
Get the title of the first deal.
|
|
2510
2510
|
|
|
2511
|
-
>>> deals[
|
|
2511
|
+
>>> deals["dr"][0]["title"]
|
|
2512
2512
|
'Orange Cream Rooibos, Tea Bags - Vanilla, Orange | Caffeine-Free,
|
|
2513
2513
|
Antioxidant-rich, Hot & Iced | The Spice Hut, First Sip Of Tea'
|
|
2514
2514
|
|
|
@@ -2524,7 +2524,7 @@ class Keepa:
|
|
|
2524
2524
|
... "includeCategories": [16310101],
|
|
2525
2525
|
... }
|
|
2526
2526
|
>>> async def main():
|
|
2527
|
-
... key =
|
|
2527
|
+
... key = "<REAL_KEEPA_KEY>"
|
|
2528
2528
|
... api = await keepa.AsyncKeepa().create(key)
|
|
2529
2529
|
... categories = await api.search_for_categories("movies")
|
|
2530
2530
|
... return await api.deals(deal_parms)
|
|
@@ -2630,9 +2630,9 @@ class AsyncKeepa:
|
|
|
2630
2630
|
|
|
2631
2631
|
>>> import asyncio
|
|
2632
2632
|
>>> import keepa
|
|
2633
|
-
>>> product_parms = {
|
|
2633
|
+
>>> product_parms = {"author": "jim butcher"}
|
|
2634
2634
|
>>> async def main():
|
|
2635
|
-
... key =
|
|
2635
|
+
... key = "<REAL_KEEPA_KEY>"
|
|
2636
2636
|
... api = await keepa.AsyncKeepa().create(key)
|
|
2637
2637
|
... return await api.product_finder(product_parms)
|
|
2638
2638
|
...
|
|
@@ -2652,12 +2652,12 @@ class AsyncKeepa:
|
|
|
2652
2652
|
>>> import asyncio
|
|
2653
2653
|
>>> import keepa
|
|
2654
2654
|
>>> async def main():
|
|
2655
|
-
... key =
|
|
2655
|
+
... key = "<REAL_KEEPA_KEY>"
|
|
2656
2656
|
... api = await keepa.AsyncKeepa().create(key)
|
|
2657
|
-
... return await api.query(
|
|
2657
|
+
... return await api.query("B0088PUEPK")
|
|
2658
2658
|
...
|
|
2659
2659
|
>>> response = asyncio.run(main())
|
|
2660
|
-
>>> response[0][
|
|
2660
|
+
>>> response[0]["title"]
|
|
2661
2661
|
'Western Digital 1TB WD Blue PC Internal Hard Drive HDD - 7200 RPM,
|
|
2662
2662
|
SATA 6 Gb/s, 64 MB Cache, 3.5" - WD10EZEX'
|
|
2663
2663
|
|
|
@@ -3115,11 +3115,11 @@ def process_used_buybox(buybox_info: List[str]) -> pd.DataFrame:
|
|
|
3115
3115
|
``pandas.DataFrame``.
|
|
3116
3116
|
|
|
3117
3117
|
>>> import keepa
|
|
3118
|
-
>>> key =
|
|
3118
|
+
>>> key = "<REAL_KEEPA_KEY>"
|
|
3119
3119
|
>>> api = keepa.Keepa(key)
|
|
3120
|
-
>>> response = api.query(
|
|
3120
|
+
>>> response = api.query("B0088PUEPK", offers=20)
|
|
3121
3121
|
>>> product = response[0]
|
|
3122
|
-
>>> buybox_info = product[
|
|
3122
|
+
>>> buybox_info = product["buyBoxUsedHistory"]
|
|
3123
3123
|
>>> df = keepa.process_used_buybox(buybox_info)
|
|
3124
3124
|
datetime user_id condition isFBA
|
|
3125
3125
|
0 2022-11-02 16:46:00 A1QUAC68EAM09F Used - Like New True
|
|
@@ -3156,10 +3156,10 @@ def process_used_buybox(buybox_info: List[str]) -> pd.DataFrame:
|
|
|
3156
3156
|
|
|
3157
3157
|
df = pd.DataFrame(
|
|
3158
3158
|
{
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3159
|
+
"datetime": datetime_arr,
|
|
3160
|
+
"user_id": user_id_arr,
|
|
3161
|
+
"condition": condition_arr,
|
|
3162
|
+
"isFBA": isFBA_arr,
|
|
3163
3163
|
}
|
|
3164
3164
|
)
|
|
3165
3165
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|