File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,20 @@ def _extract_author(auth):
41
41
42
42
43
43
def _extract_language (alpha_3 ):
44
+ if not alpha_3 :
45
+ return _read_language ()
44
46
try :
45
47
return pycountry .languages .get (alpha_3 = alpha_3 ).name
46
48
except AttributeError :
47
49
try :
48
50
return pycountry .languages .get (alpha_2 = alpha_3 [:2 ]).name
49
51
except AttributeError :
50
52
# I give up
51
- return input ('Please specify the book\' s Language: ' )
53
+ return _read_language ()
54
+
55
+
56
+ def _read_language ():
57
+ return input ('Please specify the book\' s Language: ' )
52
58
53
59
54
60
def _extract_shelves (shelves , take ):
@@ -104,7 +110,7 @@ def search(self, path):
104
110
105
111
if isbn :
106
112
log .debug ("Searching Goodreads by ISBN {} for '{}'" ,
107
- isbn , book [ 'Title' ] )
113
+ isbn , book . get ( 'Title' , isbn ) )
108
114
return self .show_by_isbn (isbn )
109
115
elif book ['Title' ]:
110
116
search_term = book ['Title' ]
Original file line number Diff line number Diff line change 3
3
4
4
"""
5
5
Note, read https://openlibrary.org/dev/docs/api/covers
6
- The cover access by ids other than CoverID and OLID are rate-limited.
6
+ The cover access by ids other than CoverID and OLID are rate-limited.
7
7
Currently only 100 requests/IP are allowed for every 5 minutes.
8
- If any IP tries to access more that the allowed limit,
8
+ If any IP tries to access more that the allowed limit,
9
9
the service will return "403 Forbidden" status.
10
10
"""
11
11
12
- from .logging import log
13
-
14
12
API_URL = 'http://covers.openlibrary.org/b/{}/{}-{}.jpg'
15
13
16
14
You can’t perform that action at this time.
0 commit comments