python的商品打折如何表示,如何获得的价格优惠清单上的项目从亚马逊与Python,亚马逊产品的API item_lookup功能?...

I am trying to write a function to get a list of offers (their prices) for an item based on the ASIN:

def price_offers(asin):

from amazonproduct import API, ResultPaginator, AWSError

from config import AWS_KEY, SECRET_KEY

api = API(AWS_KEY, SECRET_KEY, 'de')

str_asin = str(asin)

node = api.item_lookup(id=str_asin, ResponseGroup='Offers', Condition='All', MerchantId='All')

for a in node:

print a.Offer.OfferListing.Price.FormattedPrice

Failure instance: Traceback: : no such child: {http://webservices.amazon.com/AWSECommerceService/2009-10-01}Offer

解决方案

Seems like there is no Offer element in your response. Try

node = api.item_lookup(...)

from lxml import etree

print etree.tostring(node, pretty_print=True)

to see how the returned XML looks like.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值