diff --git a/readwise/api.py b/readwise/api.py index 0f2a599..1b6d1e9 100644 --- a/readwise/api.py +++ b/readwise/api.py @@ -234,7 +234,9 @@ def get_books( last_highlight_at=datetime.fromisoformat(book['last_highlight_at']) if book['last_highlight_at'] else None, - updated=datetime.fromisoformat(book['updated']), + updated=datetime.fromisoformat(book['updated']) + if book['updated'] + else None, cover_image_url=book['cover_image_url'], highlights_url=book['highlights_url'], source_url=book['source_url'], @@ -270,7 +272,9 @@ def get_book_highlights( location_type=highlight['location_type'], url=highlight['url'], color=highlight['color'], - updated=datetime.fromisoformat(highlight['updated']), + updated=datetime.fromisoformat(highlight['updated']) + if highlight['updated'] + else None, book_id=highlight['book_id'], tags=[ ReadwiseTag(id=tag['id'], name=tag['name']) diff --git a/readwise/models.py b/readwise/models.py index 3d59ab7..e1b952a 100644 --- a/readwise/models.py +++ b/readwise/models.py @@ -44,7 +44,7 @@ class ReadwiseBook: source: str num_highlights: int last_highlight_at: datetime | None - updated: datetime + updated: datetime | None cover_image_url: str highlights_url: str source_url: str @@ -78,6 +78,6 @@ class ReadwiseHighlight: location_type: str url: str | None color: str - updated: datetime + updated: datetime | None book_id: str tags: list[ReadwiseTag]