Skip to content

Commit

Permalink
Notion extra logging + small improvements (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves authored Oct 24, 2023
1 parent 7ffba2a commit 0a6c2af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/danswer/connectors/notion/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def _read_blocks(
data = self._fetch_blocks(page_block_id, cursor)

for result in data["results"]:
logger.debug(f"Found block for page '{page_block_id}': {result}")
result_block_id = result["id"]
result_type = result["type"]
result_obj = result[result_type]
Expand Down Expand Up @@ -280,6 +281,7 @@ def load_from_state(self) -> GenerateDocumentsOutput:
# TODO: remove once Notion search issue is discovered
if self.recursive_index_enabled and self.root_page_id:
yield from self._recursive_load()
return

query_dict = {
"filter": {"property": "object", "value": "page"},
Expand All @@ -306,6 +308,7 @@ def poll_source(
# TODO: remove once Notion search issue is discovered
if self.recursive_index_enabled and self.root_page_id:
yield from self._recursive_load()
return

query_dict = {
"page_size": self.batch_size,
Expand All @@ -328,7 +331,8 @@ def poll_source(
if __name__ == "__main__":
import os

connector = NotionConnector()
root_page_id = os.environ.get("NOTION_ROOT_PAGE_ID")
connector = NotionConnector(root_page_id=root_page_id)
connector.load_credentials(
{"notion_integration_token": os.environ.get("NOTION_INTEGRATION_TOKEN")}
)
Expand Down

1 comment on commit 0a6c2af

@vercel
Copy link

@vercel vercel bot commented on 0a6c2af Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.