How to use the isbntools.dev._exceptions.DataWrongShapeError function in isbntools

To help you get started, we’ve selected a few isbntools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xlcnd / isbntools / isbntools / _wcated.py View on Github external
def _editions(isbn, data):
    """Return the records from the parsed response."""
    try:
        # put the selected data in records
        records = [ib['isbn'][0] for ib in data['list']]
    except:    # pragma: no cover
        try:
            extra = data['stat']
            LOGGER.debug('DataWrongShapeError for %s with data %s',
                         isbn, extra)
        except:
            raise DataWrongShapeError(isbn)
        raise NoDataForSelectorError(isbn)
    return records
github xlcnd / isbntools / isbntools / _wcat.py View on Github external
def _records(isbn, data):
    """Classify (canonically) the parsed data."""
    try:
        # put the selected data in records
        recs = data['list'][0]
    except:      # pragma: no cover
        try:
            extra = data['stat']
            LOGGER.debug('DataWrongShapeError for %s with data %s',
                         isbn, extra)
        except:
            raise DataWrongShapeError(isbn)
        raise NoDataForSelectorError(isbn)

    # map canonical <- records
    return _mapper(isbn, recs)
github xlcnd / isbntools / isbntools / contrib / modules / goom / goom.py View on Github external
def _records(words, data):
    """Classify (canonically) the parsed data."""
    try:
        # put the selected data in records
        records = [d['volumeInfo'] for d in data['items']]
    except:           # pragma: no cover
        try:
            extra = data['stat']
            LOGGER.debug('DataWrongShapeError for %s with data %s',
                         words, extra)
        except:
            raise DataWrongShapeError(words)
        raise NoDataForSelectorError(words)

    # map canonical <- records
    return [_mapper(r) for r in records if _mapper(r)]
github xlcnd / isbntools / isbntools / contrib / plugins / isbndb.py View on Github external
def _records(isbn, data):
    """Classify (canonically) the parsed data."""
    try:
        # put the selected data in records
        records = data['data'][0]
    except:
        try:
            extra = data['error']
            LOGGER.debug('DataWrongShapeError for %s with data %s',
                         isbn, extra)
        except:
            raise DataWrongShapeError(isbn)
        raise NoDataForSelectorError(isbn)

    # map canonical <- records
    return _mapper(isbn, records)
github xlcnd / isbntools / isbntools / _goob.py View on Github external
def _records(isbn, data):
    """Classify (canonically) the parsed data."""
    try:
        # put the selected data in records
        records = data['items'][0]['volumeInfo']
    except:           # pragma: no cover
        try:
            extra = data['stat']
            LOGGER.debug('DataWrongShapeError for %s with data %s',
                         isbn, extra)
        except:
            raise DataWrongShapeError(isbn)
        raise NoDataForSelectorError(isbn)

    # map canonical <- records
    return _mapper(isbn, records)