python商品总价,如何使用Python亚马逊简单产品API来获取商品的价格

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)

解决方案

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'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值