Using Amazon's API to find a product's UPC (Python)

Question:

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!

Asked By: Art Vandelay

||

Answers:

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:

node = api.item_lookup('B001OXUIIG', ResponseGroup='Medium')

Under itemAttributes, you should see the upc field (which is “092633186909” for the item you are looking for).

Answered By: user635090