Get Amazon Affiliate Links With Image From Python Using Amazon’s API.

This script will show you how to build an Amazon affiliate link with image from the new API that generates HTML that can be inserted into a blog. I made this as an example for my wife. She ended up using a plugin in WordPress. It uses python-amazon-paapi to do all the heavy lifting. You can enter the ASIN in the var and run without Flet or, if you prefer a GUI and wish to use Flet, you can install it.

A good IDE for Python is PyCharm. It’s free and will automatically create a virtual environment. It’s below the 30 day trial of pro edition.

If you are not a programmer.

Install Python, copy the program below into a text editor like Notepad, save as get_affiliate_link.py

Be sure to fill in the API key, secret, your affiliate id, along with the asin for the product you want to display.

I did not put a lot of work into the HTML so change anything there you think will make it fit your design. Be sure not to remove anything starting with $ or ${} in the HTML.

To run, open the terminal or command prompt and run: python get_affiliate_link.py OR python3 get_affiliate_link.py

Code:

Python

Enjoy, and have fun learning!