Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active Jun 16, 2016
Embed
What would you like to do?
【Python】JANコードからASINを取得する方法
from amazon.api import AmazonAPI
from amazon.api import LookupException, AsinNotFound
import sys
if __name__ == "__main__":
amazon = AmazonAPI(
"ACCESS_KEY",
"SECRET_KEY",
"ASSOC_TAG",
region="JP")
try:
product = amazon.lookup(ItemId="4971633002005", IdType="EAN", SearchIndex="All")
except LookupException:
sys.exit("Lookup Exception")
except AsinNotFound:
sys.exit("Asin Not Found")
except Exception, e:
sys.exit(e)
print product.asin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment