问题
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