使用亚马逊的 API 查找产品的 UPC (Python)
我一直在尝试创建一个 python 脚本,使用产品的 ASIN 返回(通过亚马逊的 API)其 UPC。到目前为止,我尝试使用的模块是 python-amazon-product-api (http://packages.python.org/python-amazon-product-api/),但该模块似乎不提供 UPC (或者,至少,我在产品属性下找不到它)。使用这个模块可以吗?如果不是,我应该改用什么?到目前为止,这是我所拥有的:
import amazonproduct
SECRET_KEY = 'xxx'
AWS_KEY = 'yyy'
api = amazonproduct.API(AWS_KEY,SECRET_KEY,'us')
node = api.item_lookup('B001OXUIIG')
并且,UPC 似乎并不位于 node.Items.Item.ItemAttributes 下。预先感谢您的帮助!
I've been trying to create a python script that uses a product's ASIN to return (via Amazon's API) its UPC. The module I've attempted to use thusfar is python-amazon-product-api (http://packages.python.org/python-amazon-product-api/), but it doesn't appear that this module supplies the UPC (or, at least, I can't find it under a product's attributes). Is this possible using this module? If not, what should I switch to? Here's what I have so far:
import amazonproduct
SECRET_KEY = 'xxx'
AWS_KEY = 'yyy'
api = amazonproduct.API(AWS_KEY,SECRET_KEY,'us')
node = api.item_lookup('B001OXUIIG')
And, again, the UPC doesn't appear to be under node.Items.Item.ItemAttributes . Thanks in advance for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
item_lookup 调用仅获取基本信息。您需要使用 ResponseGroup 参数来指定您希望 Amazon 返回哪些信息(请参阅 亚马逊的 ItemLookup 文档 了解更多信息)。如果您想获得其他产品属性,您应该请求“中”响应组。您的 API 调用如下所示:
在 itemAttributes 下,您应该看到 upc 字段(您要查找的项目为“092633186909”)。
The item_lookup call only gets basic information. You will need to use the ResponseGroup parameter to specify what information you want Amazon to return (see Amazon's ItemLookup Documentation for more information). If you want to get additional product attributes, you should request the "Medium" response group. Your API call would look like:
Under itemAttributes, you should see the upc field (which is "092633186909" for the item you are looking for).