You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
398 B
16 lines
398 B
import requests
|
|
|
|
|
|
def fromisbn(isbn: str):
|
|
isbn = "".join(filter(str.isnumeric, isbn))
|
|
api = f"https://www.googleapis.com/books/v1/volumes?q=isbn:{isbn}"
|
|
resp = requests.get(api)
|
|
return resp.json()["items"][0]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
from pprint import pprint
|
|
|
|
pprint(fromisbn("9780316029193"))
|
|
pprint(fromisbn("978-0316029193"))
|
|
pprint(fromisbn("0316029193"))
|
|
|