<s> import logging <EOL> from worldcat . request . xid import xISBNRequest <EOL> from goodreads import GoodReadsClient <EOL> def get_books ( user_id , shelf_name ) : <EOL> key = "<STR_LIT>" <EOL> secret = "<STR_LIT>" <EOL> goodreads_client = GoodReadsClient ( key , secret ) <EOL> return goodreads_client . get_shelf ( user_id , shelf_name ) <EOL> def book_search ( isbn ) : <EOL> o = xISBNRequest ( rec_num = isbn , method = '<STR_LIT>' ) <EOL> o . validate ( ) <EOL> r = o . get_response ( ) <EOL> return r . data [ "<STR_LIT:list>" ] [ <NUM_LIT:0> ] <EOL> def main ( ) : <EOL> goodreads_user_id = "<STR_LIT>" <EOL> goodreads_shelf = "<STR_LIT>" <EOL> for book in get_books ( goodreads_user_id , goodreads_shelf ) : <EOL> isbn = book [ "<STR_LIT>" ] <EOL> title = book [ "<STR_LIT:title>" ] <EOL> goodreads_url = book [ "<STR_LIT>" ] <EOL> result = book_search ( isbn ) <EOL> worldcat_url = result [ "<STR_LIT:url>" ] [ <NUM_LIT:0> ] <EOL> print "<STR_LIT>" % ( title , isbn , goodreads_url , <EOL> worldcat_url ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> logging . basicConfig ( level = logging . DEBUG ) <EOL> main ( ) </s>
