None
Amazon Price Check
A friend of mine, enthralled with her new tablet, took to scanning each of the books in my little library. The app takes a snapshot of the ISBN and looks up the book online to get all the other details (author, title, category, etc). I figured that, given a huge CSV, it'd be an interesting experiment to figure out how much all my books were worth - were I to get market price for them, today.

Usage:
$ #acquire .csv of books w/ 4th element being ISBN
$ #fill AWS account credentials into AmazonLookup.py
$ python AmazonLookup.py


Source Code
AmazonLookup.py

CSV Example
"_id","author_details","title","isbn","publisher","date_published","rating","bookshelf_id","bookshelf","read","series_details","pages","notes",
"list_price","anthology","location","read_start","read_end","format","signed","loaned_to","anthology_titles","description","genre","date_added",
"goodreads_book_id","last_goodreads_sync_date","last_update_date","book_uuid",

"1","Colbert, Stephen","America Again: Re-becoming the Greatness We Never Weren't","9780446583978","Grand Central Publishing","2012-10-02","0","5,2,","Fiction,Political and Politics Sciences,","0","","240","","","0","S4","","","Hardcover","0","","","Book store nation, in the history of mankind there has never been a greater country than America<em>. </em>You could say we're the #1 nation at being the best at greatness.<br /><br />But as perfect as America is in every single way, America is broken! And we can't exchange it because we're 236 years past the 30-day return window. Look around--we don't make anything anymore, we've mortgaged our future to China, and the Apologist-in-Chief goes on world tours just to bow before foreign leaders. Worse, the L.A. Four Seasons Hotel doesn't even have a dedicated phone button for the Spa. You have to dial an extension! Where did we lose our way?!<br /><br />It's high time we restored America to the greatness it never lost!<br /><br />Luckily, <em>AMERICA AGAIN</em> will singlebookedly pull this country back from the brink. It features everything from chapters, to page numbers, to fonts. Covering subject's ranging from healthcare (""I shudder to think where we'd be without the wide variety of prescription drugs to treat our maladies, such as think-shuddering"") to the economy (""Life is giving us lemons, and we're shipping them to the Chinese to make our lemon-flavored leadonade"") to food (""Feel free to deep fry this book-it's a rich source of fiber""), Stephen gives America the dose of truth it needs to get back on track.","Humor / Topic / Political","2012-12-13 21:45:57","0","0000-00-00","2012-12-13 22:40:57","5be94c21526cd57588b424537c4ff508",

CSV => ISBN

Python's csv library made selecting each ISBN a breeze; csv.reader(open(library)) to get all the rows and row[3] was ISBN.

ISBN => Amazon Marketplace Price

Lookup up each ISBN on Amazon proved less straightforward (they don't exactly seem to encourage price checks). The first step is to register an Amazon Web Services (AWS) account for an AccessKey, SecretKey, and AssociatesId. The next is figuring out their interface regarding pricing. The following function appeared to fetch most of the data just fine, but about 30% of queries failed. They may not actually be sold by Amazon, may not have a public offer, or are only sold through the secondary Amazon market.

def getPrice(api,isbn):
try:
item = api.item_lookup(isbn,IdType='ISBN',SearchIndex='Books',ResponseGroup='Offers')
price = int(item.Items.Item.Offers.Offer.OfferListing.Price.Amount)
return price/100.0
except Exception as e:
print 'failed to lookup',isbn,'->',e
return None



- Kelson (kelson@shysecurity.com)