By Benoit (Summer2) / @benoitvallon
def requestIsbndb(book): pageName = book['title'] pageName = pageName.replace("_", " ") if book['author'] != 'Unknow': pageName = pageName + " " + book['author'] print book print pageName pageNameEncoded = urllib2.quote(pageName.encode('UTF-8')) print 'Request for: ' + pageNameEncoded isbndbXml = urllib2.urlopen("http://isbndb.com/api/v2/xml/" + current_app.config['ISBNDB_KEY'] + "/books?q=" + pageNameEncoded).read() bestResult = getIsbndbBestResult(isbndbXml) book['description'] = bestResult.find('physical_description_text').text isbn10 = bestResult.find('isbn10').text book['imageLink'] = "http://covers.openlibrary.org/b/isbn/" + isbn10 + ".jpg" return book