Last active
June 18, 2017 13:48
-
-
Save nishidy/5ea506b145c4e887003914e68d525b61 to your computer and use it in GitHub Desktop.
Amazon 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
import os | |
import time | |
from amazon.api import AmazonAPI | |
AMAZON_ACCESS_KEY = os.environ['AWSAccessKeyId'] | |
AMAZON_SECRET_KEY = os.environ['AWSSecretKey'] | |
AMAZON_ASSOC_TAG = os.environ['AWSAssocId'] | |
print(AMAZON_ACCESS_KEY[-5:]) | |
print(AMAZON_SECRET_KEY[-5:]) | |
print(AMAZON_ASSOC_TAG[-5:]) | |
amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG, region="JP") | |
time.sleep(1) | |
product = amazon.lookup(ItemId='B01NBV0SUW') | |
print(product.title) | |
print(product.price_and_currency) | |
print(product.ean) | |
print(product.large_image_url) | |
print(product.get_attribute('Publisher')) | |
print(product.get_attributes(['ItemDimensions.Width', 'ItemDimensions.Height'])) | |
time.sleep(1) | |
products = amazon.search_n(10,Keywords='kindle',SearchIndex='All') | |
for i, product in enumerate(products): | |
print("#{0}: {1}".format(i,product.title)) | |
time.sleep(1) | |
products = amazon.search_n(10,Keywords='adidas,shoes,25.0',SearchIndex='All') | |
for i, product in enumerate(products): | |
print("#{0}: {1} {2}".format(i,product.title[:75],product.price_and_currency)) | |
Author
nishidy
commented
May 21, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment