1616 API Key""" ))
1717
1818
19- def extract_authors (authors ):
19+ def _extract_authors (authors ):
2020 if isinstance (authors ['author' ], OrderedDict ):
2121 return [{
2222 'name' : authors ['author' ]['name' ],
2323 'link' : authors ['author' ]['link' ]
2424 }]
2525 else :
26- return [extract_author (auth )
26+ return [_extract_author (auth )
2727 for auth in authors ['author' ]]
2828
2929
30- def extract_author (auth ):
30+ def _extract_author (auth ):
3131 return {
3232 'name' : auth ['name' ],
3333 'link' : auth ['link' ]
3434 }
3535
3636
37- def process_book (books ):
37+ def _process_book (books ):
3838 keys_wanted = ['id' , 'title' , 'isbn' , 'isbn13' , 'description' ,
3939 'language_code' , 'publication_year' , 'publisher' ,
4040 'image_url' , 'url' , 'authors' , 'average_rating' , 'work' ]
4141 book = {k : v for k , v in books if k in keys_wanted }
42- book ['authors' ] = extract_authors (book ['authors' ])
42+ book ['authors' ] = _extract_authors (book ['authors' ])
4343 book ['ratings_count' ] = int (book ['work' ]['ratings_count' ]['#text' ])
4444 return book
4545
@@ -50,7 +50,7 @@ def __init__(self, interactive=True):
5050 developer_key = config .get ('Goodreads' , 'api_key' ))
5151
5252 def show_by_isbn (self , isbn ):
53- return process_book (self .goodreads .Book .show_by_isbn (
53+ return _process_book (self .goodreads .Book .show_by_isbn (
5454 isbn ).items ())
5555
5656 def search (self , path ):
@@ -101,5 +101,5 @@ def search(self, path):
101101 id = result ['best_book' ]['id' ].get ('#text' , '' )
102102 log .debug ("Selected Goodreads item {}" , id )
103103 log .debug ("Searching Goodreads by ID {}" , id )
104- return process_book (self .goodreads .Book .show (
104+ return _process_book (self .goodreads .Book .show (
105105 id ).items ())
0 commit comments