Skip to content

Commit

Permalink
Merge pull request #173 from myd7349/fix-key-error
Browse files Browse the repository at this point in the history
fix: handle potential KeyError
  • Loading branch information
yihong0618 authored Jun 18, 2024
2 parents 7d8a3ab + 2ddeb14 commit 9013bcf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kindle_download_helper/kindle.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@ def get_all_books(self, start_index=0, filetype="EBOK"):
if not result.get("success", True):
logger.error("get all books error: %s", result.get("error"))
break
items = result["OwnershipData"]["items"]
try:
items = result["OwnershipData"]["items"]
except KeyError:
logger.error("get all books error: %s", result.get("error"))
break
for item in items:
if filetype == "PDOC":
item["title"] = html.unescape(item["title"])
Expand Down

0 comments on commit 9013bcf

Please sign in to comment.