【Python】Amazon Product Advertising APIを使ってASINから商品の重量・高さ・横幅・奥行きを取得する方法です。
Amazon Simple Product APIをインストール
pip install python-amazon-simple-product-api
商品の重量・高さ・横幅・奥行きを取得
サンプルコードは以下の通りです。
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 | |
AMAZON_ACCESS_KEY = "amazon_access_key" | |
AMAZON_SECRET_KEY = "amazon_secret_key" | |
AMAZON_ASSOC_TAG = "amazon_assoc_tag" | |
amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG, region="JP") | |
try: | |
product = amazon.lookup(ItemId="B00BMKMP6Y") | |
print product.get_attributes(['ItemDimensions.Width', 'ItemDimensions.Height', 'ItemDimensions.Length', 'ItemDimensions.Weight']) | |
except Exception, e: | |
print e |