Created
April 14, 2012 09:28
-
-
Save cloverrose/2383141 to your computer and use it in GitHub Desktop.
example bottlenose.ASIN search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
access_key_id='' | |
secret_key='' | |
associate_tag='-22' | |
region='JP' | |
xmlns='{http://webservices.amazon.com/AWSECommerceService/2011-08-01}' | |
import bottlenose | |
from xml.etree.ElementTree import fromstring | |
def getASIN(): | |
amazon=bottlenose.Amazon(access_key_id,secret_key,associate_tag,Region=region) | |
result=amazon.ItemLookup(ItemId='4063870901' | |
,IdType='ASIN' | |
,ResponseGroup='Small') | |
root=fromstring(result) | |
Items=root.find(xmlns+'Items') | |
for item in Items.findall(xmlns+'Item'): | |
print '--' | |
attrs=item.find(xmlns+'ItemAttributes') | |
if attrs: | |
print attrs.findtext(xmlns+'Title') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment