Fix notion title bug (#474)

* Update notion_to_jsonl.py
* Fix try-catch block
This commit is contained in:
bholagabbar 2023-09-05 13:47:42 -04:00 committed by GitHub
parent 922222a813
commit 205dc90746
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -234,7 +234,11 @@ class NotionToJsonl(TextToJsonl):
elif title_field not in properties: elif title_field not in properties:
logger.error(f"Page {page_id} does not have a title field") logger.error(f"Page {page_id} does not have a title field")
return None, None return None, None
title = page["properties"][title_field]["title"][0]["text"]["content"] try:
title = page["properties"][title_field]["title"][0]["text"]["content"]
except Exception as e:
logger.warning(f"Error getting title for page {page_id}: {e}. Setting title as None...")
title = None
return title, content return title, content
def update_entries_with_ids(self, current_entries, previous_entries): def update_entries_with_ids(self, current_entries, previous_entries):