Last active
April 26, 2023 09:28
-
-
Save kurozumi/0232436dba81be57b9aef08c48b9e611 to your computer and use it in GitHub Desktop.
【Python】JANコードからASINを取得する方法
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
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