xlcnd / isbnlib

python library to validate, clean, transform and get metadata of ISBN strings (for devs).
Other
229 stars 30 forks source link

[Enhancement] `meta` be able to ignore ISBNNotConsistentError #117

Closed athossampayo closed 2 years ago

athossampayo commented 2 years ago

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'}])
xlcnd commented 2 years ago

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.

athossampayo commented 2 years ago

@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?

xlcnd commented 2 years ago

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?