Skip to content

Commit

Permalink
書名、著者の取得できるようになりました🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
nesosuke committed Mar 20, 2020
1 parent 814ce5c commit 6062435
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions google_books_api.py
@@ -1,13 +1,14 @@
#Google BooksでAPIを叩く
import requests as req
import json

ISBN = 9784873117386
response = req.get(
'https://www.googleapis.com/books/v1/volumes',
params={
"q": "isbn=" + str(ISBN)
})
response = dict(response.json()).get("items")
#response = json.loads(response)

print(response)
BookInfo = dict(response.json()).get("items")[0]["volumeInfo"]
BookTitle = BookInfo["title"]
BookAuthor = BookInfo["authors"][0]
print("Title: " + BookTitle)
print("Author: " + BookAuthor)

0 comments on commit 6062435

Please sign in to comment.