Python Network Programming
by Abhishek Ratan, Eric Chou, Pradeeban Kathiravelu, Dr. M. O. Faruque Sarker
How it works...
This recipe uses the third-party bottlenose library's Amazon() class to create an object for searching Amazon through the product search API. This is done by the top-level search_for_books() function. The ItemSearch() method of this object is invoked with passing values to the SearchIndex and Keywords keys. It uses the relevancerank method to sort the search results.
The search results are processed using the XMLmodule's minidom interface, which has a useful parseString() method. It returns the parsed XML tree-like data structure. The getElementsByTagName() method on this data structure helps to find the item's information. The item attributes are then looked up and placed in a dictionary of parsed items. Finally, all the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access