From 1b569339696b43cf12cebfc331385f07304773c7 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 16 Mar 2023 17:40:15 -0400 Subject: [PATCH] Fix missing isbn error --- vrobbler/apps/books/openlibrary.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vrobbler/apps/books/openlibrary.py b/vrobbler/apps/books/openlibrary.py index 96dc776..1c72a22 100644 --- a/vrobbler/apps/books/openlibrary.py +++ b/vrobbler/apps/books/openlibrary.py @@ -80,9 +80,12 @@ def lookup_book_from_openlibrary(title: str, author: str = None) -> dict: first_sentence = top.get("first_sentence")[0].get("value") except AttributeError: first_sentence = top.get("first_sentence")[0] + isbn = None + if top.get("isbn"): + isbn = top.get("isbn")[0] return { "title": top.get("title"), - "isbn": top.get("isbn")[0], + "isbn": isbn, "openlibrary_id": ol_id, "goodreads_id": get_first("id_goodreads", top), "first_publish_year": top.get("first_publish_year"),