Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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 {}
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
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 {})
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
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))
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)
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)
def query(isbn):
"""Query the openlibrary.org service for metadata."""
data = wquery(SERVICE_URL.format(isbn=isbn), user_agent=UA)
return _records(isbn, data)
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)