How to use Python Amazon Simple Product API to get price of a product

家住魔仙堡 提交于 2019-12-06 04:44:43

问题


I can't seem to get this library working. I got my access key, secret and associate tag. And I am following exact same thing as explained in the README, however I am getting (None, None) instead of price and currency. I don't understand what I am doing wrong. Is it because I signed up on amazon.in?

>>> from amazon.api import AmazonAPI
>>> amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)
>>> product = amazon.lookup(ItemId='B0051QVF7A')
>>> product.title
'Kindle, Wi-Fi, 6" E Ink Display - for international shipment'
>>> product.price_and_currency
(None, None)

回答1:


It was happening because the product I mentioned in the example was no longer available hence it was showing price as None

 >>> from amazon.api import AmazonAPI
 >>> amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)
 >>> product = amazon.lookup(ItemId='B00EOE0WKQ')
 >>> product.title
 'Amazon Fire Phone, 32GB (AT&T)'
 >>> product.price_and_currency
 (199.0, 'USD')
 >>> product.ean
 '0848719035209'
 >>> product.large_image_url
 'http://ecx.images-amazon.com/images/I/51BrZzpkWrL.jpg'


来源:https://stackoverflow.com/questions/24573983/how-to-use-python-amazon-simple-product-api-to-get-price-of-a-product

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!