Browse Source

Raise NoDataForSelectorError when isbn is not found

Stan Janssen 5 years ago
parent
commit
3772885683
3 changed files with 5 additions and 3 deletions
  1. 1 1
      isbnlib_bol/__init__.py
  2. 3 1
      isbnlib_bol/_bol.py
  3. 1 1
      setup.py

+ 1 - 1
isbnlib_bol/__init__.py

@@ -1,6 +1,6 @@
 from ._bol import query
 
-__version__ = '1.0.0'
+__version__ = '1.0.1'
 
 __plugin_main_language__ = 'en'
 __plugin_service_name__ = 'bol'

+ 3 - 1
isbnlib_bol/_bol.py

@@ -1,6 +1,7 @@
 import requests
 from bs4 import BeautifulSoup
 from isbnlib.dev import stdmeta
+from isbnlib.dev._exceptions import NoDataForSelectorError
 
 class Book:
     LANGUAGE_MAP = {"Engels": "en", "Nederlands": "nl", "Duits": "de"}
@@ -73,7 +74,6 @@ ISBN: {self.isbn}"""
             soup = BeautifulSoup(r.text, 'html.parser')
             return Book(isbn, soup)
         else:
-            print("Book not found")
             return None
 
 
@@ -81,3 +81,5 @@ def query(isbn):
     book = Book.find(isbn)
     if book:
         return book.as_record()
+    else:
+        raise NoDataForSelectorError(isbn)

+ 1 - 1
setup.py

@@ -1,7 +1,7 @@
 from setuptools import setup
 
 setup(name="isbnlib-bol",
-      version="1.0.0",
+      version="1.0.1",
       description="ISBN lookup for Bol.com",
       packages=['isbnlib_bol'],
       author="Stan Janssen",