akaszynski / keepa

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

Add process used buybox #150

Closed akaszynski closed 1 year ago

akaszynski commented 1 year ago

Resolve #148 by adding an example to process used buy box statistics.

Example

Load in product offers and convert the buy box data into a pandas.DataFrame.

>>> import keepa
>>> key = '<REAL_KEEPA_KEY>'
>>> api = keepa.Keepa(key)
>>> response = api.query('B0088PUEPK', offers=20)
>>> product = response[0]
>>> buybox_info = product['buyBoxUsedHistory']
>>> df = keepa.process_used_buybox(buybox_info)
               datetime         user_id         condition  isFBA
0   2022-11-02 16:46:00  A1QUAC68EAM09F   Used - Like New   True
1   2022-11-13 10:36:00  A18WXU4I7YR6UA  Used - Very Good  False
2   2022-11-15 23:50:00   AYUGEV9WZ4X5O   Used - Like New  False
3   2022-11-17 06:16:00  A18WXU4I7YR6UA  Used - Very Good  False
4   2022-11-17 10:56:00   AYUGEV9WZ4X5O   Used - Like New  False
..                  ...             ...               ...    ...
115 2023-10-23 10:00:00   AYUGEV9WZ4X5O   Used - Like New  False
116 2023-10-25 21:14:00  A1U9HDFCZO1A84   Used - Like New  False
117 2023-10-26 04:08:00   AYUGEV9WZ4X5O   Used - Like New  False
118 2023-10-27 08:14:00  A1U9HDFCZO1A84   Used - Like New  False
119 2023-10-27 12:34:00   AYUGEV9WZ4X5O   Used - Like New  False
codecov[bot] commented 1 year ago

Codecov Report

Merging #150 (4fb77af) into main (de7e2f7) will increase coverage by 0.31%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
+ Coverage   90.14%   90.45%   +0.31%     
==========================================
  Files           4        4              
  Lines         568      587      +19     
==========================================
+ Hits          512      531      +19     
  Misses         56       56              
Files Coverage Δ
src/keepa/__init__.py 100.00% <ø> (ø)
src/keepa/interface.py 90.17% <100.00%> (+0.38%) :arrow_up: