如何使用Python亚马逊简单产品API来获取商品的价格 [英] How to use Python Amazon Simple Product API to get price of a product

查看:2375
本文介绍了如何使用Python亚马逊简单产品API来获取商品的价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法得到的图书馆工作。我得到了我的访问密钥,秘密和准标记。而我下面同样的事情如 README解释,但是我收到(无,无)而不是价格和货币。我不明白我在做什么错。是不是因为我签署了关于amazon.in?

 >>>从amazon.api进口AmazonAPI
>>>亚马逊= AmazonAPI(AMAZON_ACCESS_KEY,AMAZON_SECRET_KEY,AMAZON_ASSOC_TAG)
>>>产品= amazon.lookup(ITEMID ='B0051QVF7A')
>>> product.title
点燃,无线网络连接,6电子墨水屏 - 国际航运
>>> product.price_and_currency
(无,无)
 

解决方案

据发生,因为我在这个例子中提到的产品已不再可用,因此它是显示的价格为

 >>>从amazon.api进口AmazonAPI
 >>>亚马逊= AmazonAPI(AMAZON_ACCESS_KEY,AMAZON_SECRET_KEY,AMAZON_ASSOC_TAG)
 >>>产品= amazon.lookup(ITEMID ='B00EOE0WKQ')
 >>> product.title
 亚马逊消防电话,32GB(AT& T公司)
 >>> product.price_and_currency
 (199.0,美元)
 >>> product.ean
 0848719035209
 >>> product.large_image_url
 http://ecx.images-amazon.com/images/I/51BrZzpkWrL.jpg
 

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'

这篇关于如何使用Python亚马逊简单产品API来获取商品的价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆