소스 검색

[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 = ""