Преглед изворни кода

[books] Short circut google lookup if it fails

Colin Powell пре 4 недеља
родитељ
комит
2f4fae7d02
1 измењених фајлова са 3 додато и 0 уклоњено
  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 = ""