Amazon Product Advertising API(商品情報API)の活用方法
実行環境:
Windows 10
このAPIは実行環境によりエラーの発生頻度が変わってくるそうです。
pip install
sample.py: Sample code- python
認証キー情報はAmazonアフリエイトから取得することが可能です。
Amazonアソシエイトの管理ページのメニューバーから ツール > Product Advertising APIからリクエストが可能です。
ACCESS_KEY = "<YOUR API KEY>":
SECRET_KEY = "<YOUR SECRET KEY>"
ASSOCIATE_ID = "<INPUT YOUR ID>"
COUNTRY = "JP" 取得する国の情報
keyword = "検索したい商品の名前"
取得する情報はjson形式で出力されます。
>>>
{'data': [{'asin': 'B08GZR18S3',
'browse_node_info': {'browse_nodes': [{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料・お酒',
'display_name': '食品・飲料・お酒',
'id': '57239051'},
'context_free_name': '食品&飲料',
'display_name': 'カテゴリー別',
'id': '57240051'},
'context_free_name': 'ドリンク',
'display_name': 'ドリンク',
'id': '71442051'},
'context_free_name': '水・ミネラルウォーター',
'display_name': '水・ミネラルウォーター',
'id': '71443051'},
'children': None,
'context_free_name': 'ミネラルウォーター',
'display_name': 'ミネラルウォーター',
'id': '4844225051',
'is_root': False,
'sales_rank': 3},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料・お酒',
'display_name': '食品・飲料・お酒',
'id':
'57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id': '2141353051'},
'context_free_name': 'Special '
'Features ' 'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': '2021',
'display_name': '2021',
'id': '8504556051'},
'context_free_name': '04',
'display_name': '04',
'id': '10284311051'},
'context_free_name': '21',
'display_name': '21',
'id': '10290118051'},
'context_free_name': '1025',
'display_name': '1025',
'id': '10290174051'},
'children': None,
'context_free_name': '定期おトク便AFC除外',
'display_name': '定期おトク便AFC除外',
'id': '10290175051',
'is_root': False,
'sales_rank': None},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料・お酒',
'display_name': '食品・飲料・お酒',
'id':
'57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id': '2141353051'},
'context_free_name': 'Special '
'Features ' 'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': '2021',
'display_name': '2021',
'id': '8504556051'},
'context_free_name': '06',
'display_name': '06',
'id': '10318931051'},
'context_free_name': '08',
'display_name': '08',
'id': '10318932051'},
'context_free_name': '1627',
'display_name': '1627',
'id': '10318940051'},
'children': None,
'context_free_name': '業務用・大容量\u3000'
'食品&飲料',
'display_name': '業務用・大容量\u3000食品&飲料',
'id': '2443944051',
'is_root': False,
'sales_rank': None},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料・お酒',
'display_name': '食品・飲料・お酒',
'id':
'57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id': '2141353051'},
'context_free_name': 'Special '
'Features ' 'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': '2021',
'display_name': '2021',
'id': '8504556051'},
'context_free_name': '06',
'display_name': '06',
'id': '10318931051'},
'context_free_name': '08',
'display_name': '08',
'id': '10318932051'},
'context_free_name': '1634',
'display_name': '1634',
'id': '10318972051'},
'children': None,
'context_free_name': 'あわせ買い',
'display_name': 'あわせ買い',
'id': '3418241051',
'is_root': False,
'sales_rank': None},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料・お酒',
'display_name': '食品・飲料・お酒',
'id':
'57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id': '2141353051'},
'context_free_name': 'Special '
'Features ' 'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': '2021',
'display_name': '2021',
'id': '8504556051'},
'context_free_name': '06',
'display_name': '06',
'id': '10318931051'},
'context_free_name': '08',
'display_name': '08',
'id': '10318932051'},
'context_free_name': '1636',
'display_name': '1636',
'id': '10318986051'},
'children': None,
'context_free_name': '定期おトク便\u3000OLS '
'Browse Test',
'display_name': '定期おトク便\u3000OLS '
'Browse Test',
'id': '3606294051',
'is_root': False,
'sales_rank': None},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料・お酒',
'display_name': '食品・飲料・お酒',
'id':
'57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id': '2141353051'},
'context_free_name': 'Special '
'Features ' 'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': '2021',
'display_name': '2021',
'id': '8504556051'},
'context_free_name': '06',
'display_name': '06',
'id': '10318931051'},
'context_free_name': '08',
'display_name': '08',
'id': '10318932051'},
'context_free_name': '1744',
'display_name': '1744',
'id': '10319022051'},
'children': None,
'context_free_name': '食品・飲料・お酒のみ',
'display_name': '食品・飲料・お酒のみ',
'id': '4478422051',
'is_root': False,
'sales_rank': None},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料・お酒',
'display_name': '食品・飲料・お酒',
'id': '57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id':
'2141353051'},
'context_free_name': 'Special '
'Features '
'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': '2021',
'display_name': '2021',
'id': '8504556051'},
'context_free_name': '06',
'display_name': '06',
'id': '10318931051'},
'context_free_name': '08',
'display_name': '08',
'id': '10318932051'},
'context_free_name': '1859',
'display_name': '1859',
'id': '10319103051'},
'context_free_name': 'おせちHQP紐付用レトルト除く',
'display_name': 'おせちHQP紐付用レトルト除く',
'id': '5378501051'},
'children': None,
'context_free_name': 'ドリンク',
'display_name': 'ドリンク',
'id': '5378502051',
'is_root': False,
'sales_rank': None},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料・お酒',
'display_name': '食品・飲料・お酒',
'id':
'57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id': '2141353051'},
'context_free_name': 'Special '
'Features ' 'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': '2021',
'display_name': '2021',
'id': '8504556051'},
'context_free_name': '06',
'display_name': '06',
'id': '10318931051'},
'context_free_name': '08',
'display_name': '08',
'id': '10318932051'},
'context_free_name': '2015',
'display_name': '2015',
'id': '10319191051'},
'children': None,
'context_free_name': 'サントリー\u3000テスト',
'display_name': 'サントリー\u3000テスト',
'id': '7903105051',
'is_root': False,
'sales_rank': None},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料・お酒',
'display_name': '食品・飲料・お酒',
'id': '57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id': '2141353051'},
'context_free_name': 'Special '
'Features '
'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': '2021',
'display_name': '2021',
'id': '8504556051'},
'context_free_name': '06',
'display_name': '06',
'id':
'10318931051'},
'context_free_name': '08',
'display_name': '08',
'id': '10318932051'},
'context_free_name': '2021',
'display_name': '2021',
'id': '10319222051'},
'context_free_name': '2020',
'display_name': '2020',
'id': '8151496051'},
'context_free_name': '12',
'display_name': '12',
'id': '8477143051'},
'context_free_name': '16',
'display_name': '16',
'id': '8490170051'},
'context_free_name': '1425',
'display_name': '1425',
'id': '8490171051'},
'children': None,
'context_free_name': '食品・飲料 '
'表示されている方限定キャンペーン',
'display_name': '食品・飲料 '
'表示されている方限定キャンペーン',
'id': '8490173051',
'is_root': False,
'sales_rank': None},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料
・お酒',
'display_name': '食品・飲料・お
酒',
'id': '57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id': '2141353051'},
'context_free_name': 'Special '
'Features '
'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': 'partition_089',
'display_name': 'partition_089',
'id': '10553335051'},
'context_free_name': 'partition_000',
'display_name': 'partition_000',
'id': '10553336051'},
'children': None,
'context_free_name': 'VPCキャンペーン',
'display_name': 'VPCキャンペーン',
'id': '10553337051',
'is_root': False,
'sales_rank': None},
{'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': {'ancestor': None,
'context_free_name': '食品・飲料
・お酒',
'display_name': '食品・飲料・お
酒',
'id': '57239051'},
'context_free_name': 'Self '
'Service',
'display_name': 'Self '
'Service',
'id': '2141353051'},
'context_free_name': 'Special '
'Features '
'Stores',
'display_name': 'Special '
'Features '
'Stores',
'id': '2141405051'},
'context_free_name': 'partition_057',
'display_name': 'partition_057',
'id': '22013741051'},
'context_free_name': 'partition_000',
'display_name': 'partition_000',
'id': '22013742051'},
'children': None,
'context_free_name': 'Grocery High '
'Frequent ASIN',
'display_name': 'Grocery High Frequent '
'ASIN',
'id': '22013743051',
'is_root': False,
'sales_rank': None}],
'website_sales_rank': {'context_free_name': None,
'display_name': None,
'id': None,
'sales_rank': 3}},
'detail_page_url': 'https://www.amazon.co.jp/dp/B08GZR18S3?tag=a123456789a-22&linkCode=osi&th=1&psc=1',
'images': {'primary': {'large': {'height': 497,
'url': 'https://m.media-amazon.com/images/I/51fzTUIfxkL._SL500_.jpg',
'width': 500},
'medium': {'height': 159,
'url': 'https://m.media-amazon.com/images/I/51fzTUIfxkL._SL160_.jpg',
'width': 160},
'small': {'height': 74,
'url': 'https://m.media-amazon.com/images/I/51fzTUIfxkL._SL75_.jpg',
'width': 75}},
'variants': [{'large': {'height': 500,
'url': 'https://m.media-amazon.com/images/I/51wuxNkCv5L._SL500_.jpg',
'width': 500},
'medium': {'height': 160,
'url': 'https://m.media-amazon.com/images/I/51wuxNkCv5L._SL160_.jpg',
'width': 160},
'small': {'height': 75,
'url': 'https://m.media-amazon.com/images/I/51wuxNkCv5L._SL75_.jpg',
'width': 75}},
{'large': {'height': 500,
'url': 'https://m.media-amazon.com/images/I/51At-g8VGhL._SL500_.jpg',
'width': 500},
'medium': {'height': 160,
'url': 'https://m.media-amazon.com/images/I/51At-g8VGhL._SL160_.jpg',
'width': 160},
'small': {'height': 75,
'url': 'https://m.media-amazon.com/images/I/51At-g8VGhL._SL75_.jpg',
'width': 75}},
{'large': {'height': 500,
'url': 'https://m.media-amazon.com/images/I/51h5tb+CqQL._SL500_.jpg',
'width': 500},
'medium': {'height': 160,
'url': 'https://m.media-amazon.com/images/I/51h5tb+CqQL._SL160_.jpg',
'width': 160},
'small': {'height': 75,
'url': 'https://m.media-amazon.com/images/I/51h5tb+CqQL._SL75_.jpg',
'width': 75}},
{'large': {'height': 500,
'url': 'https://m.media-amazon.com/images/I/21hhIscb+7L._SL500_.jpg',
'width': 169},
'medium': {'height': 160,
'url': 'https://m.media-amazon.com/images/I/21hhIscb+7L._SL160_.jpg',
'width': 54},
'small': {'height': 75,
'url': 'https://m.media-amazon.com/images/I/21hhIscb+7L._SL75_.jpg',
'width': 25}},
{'large': {'height': 423,
'url': 'https://m.media-amazon.com/images/I/51ZhQlFAMWL._SL500_.jpg',
'width': 500},
'medium': {'height': 135,
'url': 'https://m.media-amazon.com/images/I/51ZhQlFAMWL._SL160_.jpg',
'width': 160},
'small': {'height': 63,
'url': 'https://m.media-amazon.com/images/I/51ZhQlFAMWL._SL75_.jpg',
'width': 75}},
{'large': {'height': 500,
'url': 'https://m.media-amazon.com/images/I/61aZ+CgczNL._SL500_.jpg',
'width': 412},
'medium': {'height': 160,
'url': 'https://m.media-amazon.com/images/I/61aZ+CgczNL._SL160_.jpg',
'width': 131},
'small': {'height': 75,
'url': 'https://m.media-amazon.com/images/I/61aZ+CgczNL._SL75_.jpg',
'width': 61}},
{'large': {'height': 71,
'url': 'https://m.media-amazon.com/images/I/419S56vM18L._SL500_.jpg',
'width': 500},
'medium': {'height': 22,
'url': 'https://m.media-amazon.com/images/I/419S56vM18L._SL160_.jpg',
'width': 160},
'small': {'height': 10,
'url': 'https://m.media-amazon.com/images/I/419S56vM18L._SL75_.jpg',
'width': 75}},
{'large': {'height': 500,
'url': 'https://m.media-amazon.com/images/I/31EW5qy+sUL._SL500_.jpg',
'width': 375},
'medium': {'height': 160,
'url': 'https://m.media-amazon.com/images/I/31EW5qy+sUL._SL160_.jpg',
'width': 120},
'small': {'height': 75,
'url': 'https://m.media-amazon.com/images/I/31EW5qy+sUL._SL75_.jpg',
'width': 56}}]},
'item_info': {'by_line_info': {'brand': {'display_value': 'by Amazon',
'label': 'Brand',
'locale': 'ja_JP'},
'contributors': None,
'manufacturer': {'display_value': '日本キャンパック',
'label': 'Manufacturer',
'locale': 'ja_JP'}},
'classifications': {'binding': {'display_value': '食品&飲料',
'label': 'Binding',
'locale': 'ja_JP'},
'product_group': {'display_value': 'Grocery',
'label': 'ProductGroup',
'locale': 'ja_JP'}},
'content_info': None,
'content_rating': None,
'external_ids': {'ea_ns': {'display_values': ['4964621193496',
'4964621201917'],
'label': 'EAN',
'locale': 'en_US'},
'isb_ns': None,
'up_cs': None},
'features': {'display_values': ['Happy '
'Bellyの商品が発送される可能性がありますのでご了承ください',
'原材料:水(鉱水)',
'内容量: 2L×9本',
'商品サイズ(高さx奥行x幅):32.4cm×27.2cm×18.5cm',
'Amazonブランド'],
'label': 'Features',
'locale': 'ja_JP'},
'manufacture_info': None,
'product_info': {'color': None,
'is_adult_product': None,
'item_dimensions': {'height': None,
'length': None,
'weight': {'display_value': 40.78551847,
'label': 'Weight',
'locale': 'ja_JP',
'unit': 'pounds'},
'width': None},
'release_date': None,
'size': {'display_value': '2リットル (x 9)',
'label': 'Size',
'locale': 'ja_JP'},
'unit_count': {'display_value': 9,
'label': 'NumberOfItems',
'locale': 'en_US'}},
'technical_info': None,
'title': {'display_value': '[Amazonブランド] by Amazon 天然水ラベルレス '
'岐阜・美濃 2L×9本 (Happy Belly)',
'label': 'Title',
'locale': 'ja_JP'},
'trade_in_info': None},
'offers': {'listings': [{'availability': {'max_order_quantity': 10,
'message': '在庫あり。',
'min_order_quantity': 1,
'type': 'Now'},
'condition': {'display_value': None,
'label': None,
'locale': None,
'sub_condition': {'display_value': None,
'label': None,
'locale': None,
'value': 'New'},
'value': 'New'},
'delivery_info': {'is_amazon_fulfilled': True,
'is_free_shipping_eligible': True,
'is_prime_eligible': True,
'shipping_charges': None},
'id': 'FczUkZwEEu%2F88N%2Fnvvnm1168%2FA8VCaM1K4J5IoxU2xT%2FMfe%2B3rNR2r7%2BVYBRRwwM1%2FMBnwtOTXgEB45zez3vCxkUGiZ6N%2BjGvw3Kjq1DqdQB7O36oBfqKZU4e%2F9OCcniGzuLzqbTG3k%3D',
'is_buy_box_winner': True,
'loyalty_points': {'points': 10},
'merchant_info': {'default_shipping_country': None,
'id': 'AN1VRQENFRJN5',
'name': 'Amazon.co.jp'},
'price': {'amount': 962.0,
'currency': 'JPY',
'display_amount': '¥962 (¥107 / 本)',
'price_per_unit': 106.89,
'savings': {'amount': 62.0,
'currency': 'JPY',
'display_amount': '¥62 (6%)',
'percentage': 6,
'price_per_unit': 6.89}},
'program_eligibility': {'is_prime_exclusive': False,
'is_prime_pantry': False},
'promotions': [{'amount': 913.9,
'currency': 'JPY',
'discount_percent': 5,
'display_amount': '¥914 (5%)',
'price_per_unit': 101.54,
'type': 'SNS'}],
'saving_basis': {'amount': 1024.0,
'currency': 'JPY',
'display_amount': '¥1,024 (¥114 / '
'本)',
'price_per_unit': 113.78,
'savings': None},
'violates_map': False}],
'summaries': [{'condition': {'display_value': None,
'label': None,
'locale': None,
'sub_condition': None,
'value': 'New'},
'highest_price': {'amount': 962.0,
'currency': 'JPY',
'display_amount': '¥962 (¥107 / '
'本)',
'price_per_unit': 106.89,
'savings': None},
'lowest_price': {'amount': 962.0,
'currency': 'JPY',
'display_amount': '¥962 (¥107 / 本)',
'price_per_unit': 106.89,
'savings': None},
'offer_count': 1}]},