【问题标题】:Using python-amazon-simple-product-api to extract lowest used goods price使用 python-amazon-simple-product-api 提取最低二手商品价格
【发布时间】:2014-09-09 13:02:04
【问题描述】:

我正在学习用python提取二手书价格 by python-amazon-simple-product-api

这是我目前使用的代码:

amazon = AmazonAPI(aws_access_key, 
                   aws_secret_key,
                   aws_associate_key)

# products = amazon.search(Keywords=book_demanded_df['isbn01'].values[1], SearchIndex='Books')
products = amazon.search(Keywords='B00CU0NSCU', SearchIndex='All')

# print book_demanded_df['isbn01'].values[1]
for i, product in enumerate(products):
    print product.title
    print product.asin
    print product.get_attribute('Manufacturer')    
    print product.get_attributes(['ItemDimensions.Width', 'ItemDimensions.Height'])
    print product.offer_url

我认为密钥应该在get_attributes,我尝试写一些类似ItemAttributes.Amount 的东西,但似乎无法正常工作。

是否可以使用此 API 做到这一点?

【问题讨论】:

    标签: python api amazon amazon-product-api


    【解决方案1】:

    我是这个小图书馆的作者。亚马逊 API 响应相当混乱,并且根据您查询的产品而有所不同。在上面的示例中,ASIN 属于 Kindle Fire 7" Tablet 系列产品。它包括 8gb 和 16gb 内存版本,每个版本都有不同的 ASIN。例如,B007T36S34 中的 8gb 版本的 ASIN。

    至于使用价格,API目前不支持,但您可以使用它作为变通方法:

    >>> products[0]._safe_get_element_text(('OfferSummary.LowestUsedPrice.FormattedPrice'))
    '$84.99'
    >>> products[0]._safe_get_element_text(('OfferSummary.LowestUsedPrice.CurrencyCode'))
    'USD'
    

    在搜索此类数据时查看Amazon Product Advertising API documentation 很有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-05
      • 2015-11-26
      • 1970-01-01
      相关资源
      最近更新 更多