Created
September 25, 2015 23:06
-
-
Save a-andreyev/82ddc875bcba8a8eba81 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/python2 | |
# pip install python-amazon-simple-product-api | |
# or | |
# pip2 install python-amazon-simple-product-api | |
# for https://www.freelancer.com/projects/php/Film-Name-Year-Amazon-Link | |
from amazon.api import AmazonAPI | |
AMAZON_ACCESS_KEY = | |
AMAZON_SECRET_KEY = | |
AMAZON_ASSOC_TAG = | |
def get_offer_url(title, year, bluray_or_dvd): | |
amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG) | |
products = amazon.search(Keywords=title+' '+year+' '+bluray_or_dvd, SearchIndex='Video') | |
return products[0].offer_url; | |
# Example: | |
print get_offer_url(title='Brick', year='2005', bluray_or_dvd='bluray') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment