How to use the isbnlib.dev.webquery.query function in isbnlib

To help you get started, we’ve selected a few isbnlib 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 / isbnlib / isbnlib / _thinged.py View on Github external
def query(isbn):
    """Query the ThingISBN service for related ISBNs."""
    data = wquery(SERVICE_URL.format(isbn=isbn),
                  user_agent=UA,
                  parser=parser_thinged)
    if not data:  # pragma: no cover
        LOGGER.debug('No data from ThingISBN for isbn %s', isbn)
        data = []
    data.append(EAN13(isbn))
    return set(data)
github xlcnd / isbnlib / isbnlib / _goom.py View on Github external
def query(words):
    """Query the Google Books (JSON API v1) for metadata."""
    words.replace(' ', '+')
    words = quote(words)
    data = wquery(SERVICE_URL.format(words=words), UA)
    return _records(words, data) if data else {}
github xlcnd / isbnlib / isbnlib / _openled.py View on Github external
def query(isbn):
    """Query the Open Library for related ISBNs."""
    try:
        data = wquery(SERVICE_URL.format(selectors=CODES.format(isbn=isbn)),
                      user_agent=UA)
        codes = {rec['key'] for rec in data}
        isbnlikes = [isbn]
        for code in codes:
            txt = wquery(
                SERVICE_URL.format(selectors=ISBNS.format(code=code)),
                user_agent=UA,
                parser=None,
            )
            isbnlikes.extend(get_isbnlike(txt))
        isbns = {u(get_canonical_isbn(isbnlike)) for isbnlike in isbnlikes}
    except Exception as ex:  # pragma: no cover
        LOGGER.debug('No data from Open Library for isbn %s -- %s', isbn,
                     str(ex))
        return {get_canonical_isbn(isbn)}
    return isbns
github xlcnd / isbnlib / isbnlib / _oclc.py View on Github external
def query_classify(isbn):
    """Query the classify.oclc service for classifiers."""
    return (wquery(
        SERVICE_URL.format(isbn=isbn),
        user_agent=UA,
        data_checker=data_checker,
        parser=parser,
    ) or {})
github xlcnd / isbnlib / isbnlib / _openled.py View on Github external
def query(isbn):
    """Query the Open Library for related ISBNs."""
    try:
        data = wquery(SERVICE_URL.format(selectors=CODES.format(isbn=isbn)),
                      user_agent=UA)
        codes = {rec['key'] for rec in data}
        isbnlikes = [isbn]
        for code in codes:
            txt = wquery(
                SERVICE_URL.format(selectors=ISBNS.format(code=code)),
                user_agent=UA,
                parser=None,
            )
            isbnlikes.extend(get_isbnlike(txt))
        isbns = {u(get_canonical_isbn(isbnlike)) for isbnlike in isbnlikes}
    except Exception as ex:  # pragma: no cover
        LOGGER.debug('No data from Open Library for isbn %s -- %s', isbn,
                     str(ex))
        return {get_canonical_isbn(isbn)}
    return isbns
github xlcnd / isbnlib / isbnlib / _wikied.py View on Github external
def query(isbn):
    """Query the wikipedia.org service for 'editions'."""
    data = wquery(SERVICE_URL.format(isbn=isbn), user_agent=UA, throttling=0)
    return set(_parser(isbn, data))
github xlcnd / isbnlib / isbnlib / _wiki.py View on Github external
def query(isbn):
    """Query the wikipedia.org service for metadata."""
    data = wquery(SERVICE_URL.format(isbn=isbn), user_agent=UA, throttling=0)
    return _records(isbn, data)
github xlcnd / isbnlib / isbnlib / _isbndb.py View on Github external
def query(isbn):
    """Query the isbndb.org service for metadata."""
    if not apikeys.get('isbndb'):
        raise NoAPIKeyError
    data = wquery(
        SERVICE_URL.format(apikey=apikeys['isbndb'], isbn=isbn), user_agent=UA)
    return _records(isbn, data)
github xlcnd / isbnlib / isbnlib / _openl.py View on Github external
def query(isbn):
    """Query the openlibrary.org service for metadata."""
    data = wquery(SERVICE_URL.format(isbn=isbn), user_agent=UA)
    return _records(isbn, data)
github xlcnd / isbnlib / isbnlib / _goob.py View on Github external
def query(isbn):
    """Query the Google Books (JSON API v1) service for metadata."""
    data = wquery(SERVICE_URL.format(isbn=isbn), user_agent=UA)
    return _records(isbn, data)