xlcnd / isbnlib

python library to validate, clean, transform and get metadata of ISBN strings (for devs).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error when using meta(isbn, service='openl')

abubelinha opened this issue · comments

Describe the bug
I get an error when usgin meta(isbn, service='openl')

To Reproduce

>>> import isbnlib
>>> isbnlib.__version__
'3.10.13'
>>> isbnlib.meta(isbn='9788428208734', service='goob')
{'ISBN-13': '9788428208734', 'Title': 'Tratado de botánica', 'Authors': ['Eduard Strasburger'], 'Publisher': '', 'Year': '1988', 'Language': 'es'}
>>> isbnlib.meta(isbn='9788428208734', service='worldcat')
{}
>>> isbnlib.meta(isbn='9788428208734', service='openl')`

 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "C:\Python38\lib\site-packages\isbnlib\_ext.py", line 25, in meta
     return query(isbn, service) if isbn else {}
   File "C:\Python38\lib\site-packages\isbnlib\dev\_decorators.py", line 27, in memoized_func
     value = func(*args, **kwargs)
   File "C:\Python38\lib\site-packages\isbnlib\_metadata.py", line 33, in query
     meta = services[service](isbn)
   File "C:\Python38\lib\site-packages\isbnlib\_openl.py", line 77, in query
     data = wquery(SERVICE_URL.format(isbn=isbn), user_agent=UA)
   File "C:\Python38\lib\site-packages\isbnlib\dev\webquery.py", line 66, in query
     return wq.parse_data(parser) if wq.check_data(data_checker) else None
   File "C:\Python38\lib\site-packages\isbnlib\dev\webquery.py", line 41, in check_data
     raise DataNotFoundAtServiceError(self.url)
 isbnlib.dev._exceptions.DataNotFoundAtServiceError: the target data was not found at this service (http://openlibrary.org/api/books?bibkeys=ISBN:9788428208734&format=json&jscmd=data)

Additional context

Windows 7
Python 3.8
isbnlib 3.10.13

#110 might be related

Thanks
@abubelinha

commented

Hi!

Yes to keep consistency with other providers, it must return only an empty dictionary!

It is fixed on 'dev'.