Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active April 26, 2023 09:28
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kurozumi/0232436dba81be57b9aef08c48b9e611 to your computer and use it in GitHub Desktop.
【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