【Python】Amazon Product Advertising APIを使ってASINから商品の重量・高さ・横幅・奥行きを取得する方法

【Python】Amazon Product Advertising APIを使ってASINから商品の重量・高さ・横幅・奥行きを取得する方法です。

Amazon Simple Product APIをインストール

pip install python-amazon-simple-product-api

商品の重量・高さ・横幅・奥行きを取得

サンプルコードは以下の通りです。

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

コメントする

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

This site uses Akismet to reduce spam. Learn how your comment data is processed.