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

[Enhancement] `meta` be able to ignore ISBNNotConsistentError

athossampayo opened this issue · comments

Regarding the use of meta():

There are times where a different ISBN is returned internally and ISBNNotConsistentError is raised, but is referent to the same book and the user might want to ignore the error and use the data found, but right now this is not possible, not even by capturing the exception.

Maybe we should add the metadata on this exception class?

One ISBN example that I found on the wild were would be useful to use the data returned:

isbnlib.dev._exceptions.ISBNNotConsistentError: isbn request != isbn response (9788487169021 not in [{'type': 'ISBN_10', 'identifier': '8487169007'}, {'type': 'ISBN_13', 'identifier': '9788487169007'}])
commented

HI.

The problem is that the data returned is not always for the same book! Sometimes, the data belongs to another 'related' book. So in order to maintain data integrity, this exception must be raised.

@xlcnd that makes sense, but could the exception class receive the returned data as an attribute so the user can decide to capture it when needed to ignore? WDYT?

commented

It will be a strange way to get the data... I personally don't like that kind of solutions! But why don't you "borrow" the code from goob.py and write a specific function to get your data?