Searching Amazon for books through the product search API
If you like to search for products on Amazon and include some of them in your website or application, this recipe can help you to do that. We can see how to search Amazon for books.
Getting ready
This recipe depends on the third-party Python bottlenose
library. You can install this library using pip, as shown in the following command:
$ pip install bottlenose
First, you need to place your Amazon account's access key, secret key, and affiliate ID into local_settings.py
. A sample settings file is provided with the book code. You can also edit this script and place it here as well.
How to do it...
We can use the bottlenose
library that implements the Amazon's product search APIs.
Listing 7.6 gives the code for searching Amazon for books through product search APIs, as shown:
#!/usr/bin/env python # Python Network Programming Cookbook, Second Edition -- Chapter - 7 # This program is optimized for Python 2.7.12 and Python 3.5.2. # It may run...