Ver Fonte

[books] Short circut google lookup if it fails

Colin Powell há 4 semanas atrás
pai
commit
2f4fae7d02
1 ficheiros alterados com 3 adições e 0 exclusões
  1. 3 0
      vrobbler/apps/books/sources/google.py

+ 3 - 0
vrobbler/apps/books/sources/google.py

@@ -29,6 +29,9 @@ def lookup_book_from_google(title: str) -> dict:
     google_result = (
         json.loads(response.content).get("items", [{}])[0].get("volumeInfo")
     )
+    if not google_result:
+        return {}
+
     publish_date = pendulum.parse(google_result.get("publishedDate"))
 
     isbn_13 = ""