alefiori82 / amazon-paapi5

Amazon Product Advertising API 5.0 wrapper for Python
MIT License
30 stars 4 forks source link

Savings returned are not present in product's page #4

Closed aegroto closed 4 years ago

aegroto commented 4 years ago

I'm using this library connecting to the 'IT' region, using standard AWS credentials (id, secret and tag).

Some of the products returned contain a 'ghost' saving that's not shown in Amazon's page.

Let's take for example this product:

https://www.amazon.it/dp/B07WP5RDM2?tag=sshopping-21&linkCode=osi&th=1&psc=1

                          'price': {'amount': 9.99,
                                    'currency': 'EUR',
                                    'display_amount': '9,99\xa0€',
                                    'price_per_unit': None,
                                    'savings': {'amount': 20.0,
                                                'currency': 'EUR',
                                                'display_amount': '20,00\xa0€ '
                                                                  '(67%)',
                                                'percentage': 67,
                                                'price_per_unit': None}},

The full price should be 29.99, with a discount of 67%. In reality 9.99 is the full price shown and no discount is reported.

The code I'm using to recover this product is: results = client.search_items( item_count=10, item_page=1, keywords="ELEFULL 10000mAh Power Bank Caricatore Portatile,2 USB Batteria Esterna con LED Digitale Display per Telefoni Moible, Tablet e Altro" )

I've uploaded the full output for convenience: https://gist.github.com/aegroto/e0ed6b85ce0f70add503584e49605b60

alefiori82 commented 4 years ago

To check is a product is in discount you have to use the property isDiscount. If true, the original price is available at originalPrice.display_amount and the discounted price is available at bestOffer.price.display_amount. Otherwise the bestOffer.price.display_amount property is the price which is equal to the originalPrice.display_amount.