mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
f3cd150bb2
commit
fcb7ce106d
@ -14,11 +14,11 @@ from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
|||||||
|
|
||||||
OPENLIBRARY = 'http://covers.openlibrary.org/b/isbn/%s-L.jpg?default=false'
|
OPENLIBRARY = 'http://covers.openlibrary.org/b/isbn/%s-L.jpg?default=false'
|
||||||
|
|
||||||
def check_for_cover(isbn):
|
def check_for_cover(isbn, timeout=5.):
|
||||||
br = browser()
|
br = browser()
|
||||||
br.set_handle_redirect(False)
|
br.set_handle_redirect(False)
|
||||||
try:
|
try:
|
||||||
br.open_novisit(OPENLIBRARY%isbn)
|
br.open_novisit(OPENLIBRARY%isbn, timeout=timeout)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
if callable(getattr(e, 'getcode', None)) and e.getcode() == 302:
|
if callable(getattr(e, 'getcode', None)) and e.getcode() == 302:
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user