notionary 0.1.12__tar.gz → 0.1.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {notionary-0.1.12 → notionary-0.1.13}/PKG-INFO +1 -1
- notionary-0.1.13/notionary/__init__.py +24 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/audio_element.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/bookmark_element.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/callout_element.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/code_block_element.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/column_element.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/divider_element.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/embed_element.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/heading_element.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/image_element.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/list_element.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/paragraph_element.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/qoute_element.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/table_element.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/todo_lists.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/toggle_element.py +1 -6
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/video_element.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/markdown_to_notion_converter.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/notion_to_markdown_converter.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/registry/block_element_registry.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/registry/block_element_registry_builder.py +18 -18
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/database/database_discovery.py +19 -17
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/database/database_info_service.py +1 -1
- notionary-0.1.12/notionary/core/database/notion_database_manager.py → notionary-0.1.13/notionary/database/notion_database.py +13 -14
- notionary-0.1.12/notionary/core/database/notion_database_manager_factory.py → notionary-0.1.13/notionary/database/notion_database_factory.py +8 -12
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/content/page_content_manager.py +6 -8
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/metadata/metadata_editor.py +2 -2
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/metadata/notion_icon_manager.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/metadata/notion_page_cover_manager.py +1 -1
- notionary-0.1.13/notionary/page/notion_page.py +504 -0
- notionary-0.1.13/notionary/page/notion_page_factory.py +256 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/properites/database_property_service.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/properites/page_property_manager.py +7 -7
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/relations/notion_page_relation_manager.py +3 -3
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/relations/notion_page_title_resolver.py +1 -1
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/relations/page_database_relation.py +1 -1
- {notionary-0.1.12 → notionary-0.1.13}/notionary/util/page_id_utils.py +3 -1
- {notionary-0.1.12 → notionary-0.1.13}/notionary.egg-info/PKG-INFO +1 -1
- notionary-0.1.13/notionary.egg-info/SOURCES.txt +59 -0
- {notionary-0.1.12 → notionary-0.1.13}/setup.py +1 -1
- notionary-0.1.12/notionary/__init__.py +0 -20
- notionary-0.1.12/notionary/core/page/notion_page_manager.py +0 -312
- notionary-0.1.12/notionary.egg-info/SOURCES.txt +0 -58
- {notionary-0.1.12 → notionary-0.1.13}/LICENSE +0 -0
- {notionary-0.1.12 → notionary-0.1.13}/README.md +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/__init__.py +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/notion_block_element.py +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/text_inline_formatter.py +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/database/models/page_result.py +0 -0
- {notionary-0.1.12 → notionary-0.1.13}/notionary/exceptions/database_exceptions.py +0 -0
- {notionary-0.1.12 → notionary-0.1.13}/notionary/exceptions/page_creation_exception.py +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/notion_client.py +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/content/notion_page_content_chunker.py +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/properites/property_formatter.py +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/properites/property_operation_result.py +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/properites/property_value_extractor.py +0 -0
- {notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/relations/relation_operation_result.py +0 -0
- {notionary-0.1.12 → notionary-0.1.13}/notionary/util/logging_mixin.py +0 -0
- {notionary-0.1.12 → notionary-0.1.13}/notionary/util/singleton_decorator.py +0 -0
- {notionary-0.1.12 → notionary-0.1.13}/notionary.egg-info/dependency_links.txt +0 -0
- {notionary-0.1.12 → notionary-0.1.13}/notionary.egg-info/requires.txt +0 -0
- {notionary-0.1.12 → notionary-0.1.13}/notionary.egg-info/top_level.txt +0 -0
- {notionary-0.1.12 → notionary-0.1.13}/setup.cfg +0 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
from .notion_client import NotionClient
|
2
|
+
|
3
|
+
from .database.notion_database import NotionDatabase
|
4
|
+
from .database.notion_database_factory import NotionDatabaseFactory
|
5
|
+
from .database.database_discovery import DatabaseDiscovery
|
6
|
+
|
7
|
+
from .page.notion_page import NotionPage
|
8
|
+
from .page.notion_page_factory import NotionPageFactory
|
9
|
+
|
10
|
+
from .converters.registry.block_element_registry import BlockElementRegistry
|
11
|
+
from .converters.registry.block_element_registry_builder import (
|
12
|
+
BlockElementRegistryBuilder,
|
13
|
+
)
|
14
|
+
|
15
|
+
__all__ = [
|
16
|
+
"NotionClient",
|
17
|
+
"NotionDatabase",
|
18
|
+
"NotionDatabaseFactory",
|
19
|
+
"DatabaseDiscovery",
|
20
|
+
"NotionPage",
|
21
|
+
"NotionPageFactory",
|
22
|
+
"BlockElementRegistry",
|
23
|
+
"BlockElementRegistryBuilder",
|
24
|
+
]
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/audio_element.py
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
import re
|
2
2
|
from typing import Dict, Any, Optional, List
|
3
|
-
from notionary.
|
3
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
4
4
|
|
5
5
|
|
6
6
|
class AudioElement(NotionBlockElement):
|
@@ -2,7 +2,7 @@ import re
|
|
2
2
|
from typing import Dict, Any, Optional, List, Tuple
|
3
3
|
from typing_extensions import override
|
4
4
|
|
5
|
-
from notionary.
|
5
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
6
6
|
|
7
7
|
|
8
8
|
class BookmarkElement(NotionBlockElement):
|
@@ -2,8 +2,8 @@ from typing import Dict, Any, Optional
|
|
2
2
|
from typing_extensions import override
|
3
3
|
import re
|
4
4
|
|
5
|
-
from notionary.
|
6
|
-
from notionary.
|
5
|
+
from notionary.converters.elements.text_inline_formatter import TextInlineFormatter
|
6
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
7
7
|
|
8
8
|
|
9
9
|
class CalloutElement(NotionBlockElement):
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import Dict, Any, Optional, List, Tuple
|
2
2
|
from typing_extensions import override
|
3
3
|
import re
|
4
|
-
from notionary.
|
4
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
5
5
|
|
6
6
|
|
7
7
|
class CodeBlockElement(NotionBlockElement):
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/column_element.py
RENAMED
@@ -2,7 +2,7 @@ import re
|
|
2
2
|
from typing import Dict, Any, Optional, List, Tuple, Callable
|
3
3
|
from typing_extensions import override
|
4
4
|
|
5
|
-
from notionary.
|
5
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
6
6
|
|
7
7
|
|
8
8
|
class ColumnElement(NotionBlockElement):
|
@@ -4,7 +4,7 @@ from typing import Dict, Any, Optional
|
|
4
4
|
from typing_extensions import override
|
5
5
|
import re
|
6
6
|
|
7
|
-
from notionary.
|
7
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
8
8
|
|
9
9
|
|
10
10
|
class DividerElement(NotionBlockElement):
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/embed_element.py
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
import re
|
2
2
|
from typing import Dict, Any, Optional, List
|
3
|
-
from notionary.
|
3
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
4
4
|
|
5
5
|
|
6
6
|
class EmbedElement(NotionBlockElement):
|
@@ -2,8 +2,8 @@ from typing import Dict, Any, Optional
|
|
2
2
|
from typing_extensions import override
|
3
3
|
import re
|
4
4
|
|
5
|
-
from notionary.
|
6
|
-
from notionary.
|
5
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
6
|
+
from notionary.converters.elements.text_inline_formatter import TextInlineFormatter
|
7
7
|
|
8
8
|
|
9
9
|
class HeadingElement(NotionBlockElement):
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/image_element.py
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
import re
|
2
2
|
from typing import Dict, Any, Optional, List
|
3
3
|
from typing_extensions import override
|
4
|
-
from notionary.
|
4
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
5
5
|
|
6
6
|
|
7
7
|
class ImageElement(NotionBlockElement):
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/list_element.py
RENAMED
@@ -1,8 +1,8 @@
|
|
1
1
|
import re
|
2
2
|
from typing import Dict, Any, Optional
|
3
3
|
from typing_extensions import override
|
4
|
-
from notionary.
|
5
|
-
from notionary.
|
4
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
5
|
+
from notionary.converters.elements.text_inline_formatter import TextInlineFormatter
|
6
6
|
|
7
7
|
|
8
8
|
class BulletedListElement(NotionBlockElement):
|
@@ -1,8 +1,8 @@
|
|
1
1
|
from typing import Dict, Any, Optional
|
2
2
|
from typing_extensions import override
|
3
3
|
|
4
|
-
from notionary.
|
5
|
-
from notionary.
|
4
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
5
|
+
from notionary.converters.elements.text_inline_formatter import TextInlineFormatter
|
6
6
|
|
7
7
|
|
8
8
|
class ParagraphElement(NotionBlockElement):
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/qoute_element.py
RENAMED
@@ -2,7 +2,7 @@ import re
|
|
2
2
|
from typing import Dict, Any, Optional, List, Tuple
|
3
3
|
from typing_extensions import override
|
4
4
|
|
5
|
-
from notionary.
|
5
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
6
6
|
|
7
7
|
|
8
8
|
class QuoteElement(NotionBlockElement):
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/table_element.py
RENAMED
@@ -3,8 +3,8 @@
|
|
3
3
|
from typing import Dict, Any, Optional, List, Tuple
|
4
4
|
from typing_extensions import override
|
5
5
|
import re
|
6
|
-
from notionary.
|
7
|
-
from notionary.
|
6
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
7
|
+
from notionary.converters.elements.text_inline_formatter import TextInlineFormatter
|
8
8
|
|
9
9
|
|
10
10
|
class TableElement(NotionBlockElement):
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/todo_lists.py
RENAMED
@@ -1,8 +1,8 @@
|
|
1
1
|
import re
|
2
2
|
from typing import Dict, Any, Optional
|
3
3
|
from typing_extensions import override
|
4
|
-
from notionary.
|
5
|
-
from notionary.
|
4
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
5
|
+
from notionary.converters.elements.text_inline_formatter import TextInlineFormatter
|
6
6
|
|
7
7
|
|
8
8
|
class TodoElement(NotionBlockElement):
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/toggle_element.py
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
import re
|
2
2
|
from typing import Dict, Any, Optional, List, Tuple, Callable
|
3
3
|
|
4
|
-
from notionary.
|
4
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
5
5
|
|
6
6
|
|
7
7
|
class ToggleElement(NotionBlockElement):
|
@@ -171,17 +171,12 @@ class ToggleElement(NotionBlockElement):
|
|
171
171
|
i += 1
|
172
172
|
continue
|
173
173
|
|
174
|
-
# Wenn context_aware aktiviert ist, prüfen wir für "Transcript"-Toggles
|
175
|
-
# ob sie direkt nach einem Bullet Point kommen
|
176
174
|
is_transcript_toggle = cls.TRANSCRIPT_TOGGLE_PATTERN.match(line.strip())
|
177
175
|
|
178
176
|
if context_aware and is_transcript_toggle:
|
179
|
-
# Prüfen, ob der Toggle in einem gültigen Kontext ist (nach Bullet Point)
|
180
177
|
if i > 0 and lines[i - 1].strip().startswith("- "):
|
181
|
-
# Gültiger Kontext, fahre fort
|
182
178
|
pass
|
183
179
|
else:
|
184
|
-
# Ungültiger Kontext für Transcript-Toggle, überspringe ihn
|
185
180
|
i += 1
|
186
181
|
continue
|
187
182
|
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/converters/elements/video_element.py
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
import re
|
2
2
|
from typing import Dict, Any, Optional, List
|
3
|
-
from notionary.
|
3
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
4
4
|
|
5
5
|
|
6
6
|
class VideoElement(NotionBlockElement):
|
@@ -1,9 +1,9 @@
|
|
1
1
|
from typing import Dict, Any, List, Optional, Tuple
|
2
2
|
|
3
|
-
from notionary.
|
3
|
+
from notionary.converters.registry.block_element_registry import (
|
4
4
|
BlockElementRegistry,
|
5
5
|
)
|
6
|
-
from notionary.
|
6
|
+
from notionary.converters.registry.block_element_registry_builder import (
|
7
7
|
BlockElementRegistryBuilder,
|
8
8
|
)
|
9
9
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
from typing import Dict, Any, List, Optional
|
2
2
|
|
3
|
-
from notionary.
|
3
|
+
from notionary.converters.registry.block_element_registry import (
|
4
4
|
BlockElementRegistry,
|
5
5
|
)
|
6
|
-
from notionary.
|
6
|
+
from notionary.converters.registry.block_element_registry_builder import (
|
7
7
|
BlockElementRegistryBuilder,
|
8
8
|
)
|
9
9
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import Dict, Any, Optional, List, Type
|
2
2
|
|
3
|
-
from notionary.
|
4
|
-
from notionary.
|
3
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
4
|
+
from notionary.converters.elements.text_inline_formatter import TextInlineFormatter
|
5
5
|
|
6
6
|
|
7
7
|
class BlockElementRegistry:
|
@@ -1,30 +1,30 @@
|
|
1
1
|
from typing import List, Type
|
2
2
|
from collections import OrderedDict
|
3
3
|
|
4
|
-
from notionary.
|
5
|
-
from notionary.
|
6
|
-
from notionary.
|
7
|
-
from notionary.
|
4
|
+
from notionary.converters.elements.audio_element import AudioElement
|
5
|
+
from notionary.converters.elements.embed_element import EmbedElement
|
6
|
+
from notionary.converters.elements.notion_block_element import NotionBlockElement
|
7
|
+
from notionary.converters.registry.block_element_registry import (
|
8
8
|
BlockElementRegistry,
|
9
9
|
)
|
10
10
|
|
11
|
-
from notionary.
|
12
|
-
from notionary.
|
13
|
-
from notionary.
|
14
|
-
from notionary.
|
15
|
-
from notionary.
|
16
|
-
from notionary.
|
17
|
-
from notionary.
|
18
|
-
from notionary.
|
11
|
+
from notionary.converters.elements.paragraph_element import ParagraphElement
|
12
|
+
from notionary.converters.elements.heading_element import HeadingElement
|
13
|
+
from notionary.converters.elements.callout_element import CalloutElement
|
14
|
+
from notionary.converters.elements.code_block_element import CodeBlockElement
|
15
|
+
from notionary.converters.elements.divider_element import DividerElement
|
16
|
+
from notionary.converters.elements.table_element import TableElement
|
17
|
+
from notionary.converters.elements.todo_lists import TodoElement
|
18
|
+
from notionary.converters.elements.list_element import (
|
19
19
|
BulletedListElement,
|
20
20
|
NumberedListElement,
|
21
21
|
)
|
22
|
-
from notionary.
|
23
|
-
from notionary.
|
24
|
-
from notionary.
|
25
|
-
from notionary.
|
26
|
-
from notionary.
|
27
|
-
from notionary.
|
22
|
+
from notionary.converters.elements.qoute_element import QuoteElement
|
23
|
+
from notionary.converters.elements.image_element import ImageElement
|
24
|
+
from notionary.converters.elements.video_element import VideoElement
|
25
|
+
from notionary.converters.elements.toggle_element import ToggleElement
|
26
|
+
from notionary.converters.elements.bookmark_element import BookmarkElement
|
27
|
+
from notionary.converters.elements.column_element import ColumnElement
|
28
28
|
|
29
29
|
|
30
30
|
class BlockElementRegistryBuilder:
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/database/database_discovery.py
RENAMED
@@ -6,7 +6,7 @@ from typing import (
|
|
6
6
|
Any,
|
7
7
|
Tuple,
|
8
8
|
)
|
9
|
-
from notionary.
|
9
|
+
from notionary.notion_client import NotionClient
|
10
10
|
from notionary.util.logging_mixin import LoggingMixin
|
11
11
|
|
12
12
|
|
@@ -37,43 +37,45 @@ class DatabaseDiscovery(LoggingMixin):
|
|
37
37
|
List of tuples containing (database_title, database_id)
|
38
38
|
"""
|
39
39
|
databases = []
|
40
|
-
|
40
|
+
|
41
41
|
async for database in self._iter_databases(page_size):
|
42
42
|
db_id = database.get("id")
|
43
43
|
if not db_id:
|
44
44
|
continue
|
45
|
-
|
45
|
+
|
46
46
|
title = self._extract_database_title(database)
|
47
47
|
databases.append((title, db_id))
|
48
|
-
|
48
|
+
|
49
49
|
return databases
|
50
|
-
|
50
|
+
|
51
51
|
async def discover_and_print(self, page_size: int = 100) -> List[Tuple[str, str]]:
|
52
52
|
"""
|
53
53
|
Discover databases and print the results in a nicely formatted way.
|
54
|
-
|
54
|
+
|
55
55
|
This is a convenience method that discovers databases and handles
|
56
56
|
the formatting and printing of results.
|
57
|
-
|
57
|
+
|
58
58
|
Args:
|
59
59
|
page_size: The number of databases to fetch per request
|
60
|
-
|
60
|
+
|
61
61
|
Returns:
|
62
62
|
The same list of databases as discover() for further processing
|
63
63
|
"""
|
64
64
|
databases = await self.discover(page_size)
|
65
|
-
|
65
|
+
|
66
66
|
if not databases:
|
67
67
|
print("\n⚠️ No databases found!")
|
68
68
|
print("Please ensure your Notion integration has access to databases.")
|
69
|
-
print(
|
69
|
+
print(
|
70
|
+
"You need to share the databases with your integration in Notion settings."
|
71
|
+
)
|
70
72
|
return databases
|
71
|
-
|
73
|
+
|
72
74
|
print(f"✅ Found {len(databases)} databases:")
|
73
|
-
|
75
|
+
|
74
76
|
for i, (title, db_id) in enumerate(databases, 1):
|
75
77
|
print(f"{i}. {title} (ID: {db_id})")
|
76
|
-
|
78
|
+
|
77
79
|
return databases
|
78
80
|
|
79
81
|
async def _iter_databases(
|
@@ -113,7 +115,7 @@ class DatabaseDiscovery(LoggingMixin):
|
|
113
115
|
|
114
116
|
if not result.get("has_more") or not result.get("next_cursor"):
|
115
117
|
return
|
116
|
-
|
118
|
+
|
117
119
|
start_cursor = result["next_cursor"]
|
118
120
|
|
119
121
|
def _extract_database_title(self, database: Dict[str, Any]) -> str:
|
@@ -128,7 +130,7 @@ class DatabaseDiscovery(LoggingMixin):
|
|
128
130
|
"""
|
129
131
|
if "title" not in database:
|
130
132
|
return "Untitled"
|
131
|
-
|
133
|
+
|
132
134
|
title_parts = []
|
133
135
|
for text_obj in database["title"]:
|
134
136
|
if "plain_text" in text_obj:
|
@@ -136,5 +138,5 @@ class DatabaseDiscovery(LoggingMixin):
|
|
136
138
|
|
137
139
|
if not title_parts:
|
138
140
|
return "Untitled"
|
139
|
-
|
140
|
-
return "".join(title_parts)
|
141
|
+
|
142
|
+
return "".join(title_parts)
|
@@ -1,12 +1,12 @@
|
|
1
1
|
from typing import Any, AsyncGenerator, Dict, List, Optional
|
2
2
|
|
3
|
-
from notionary.
|
4
|
-
from notionary.
|
3
|
+
from notionary.notion_client import NotionClient
|
4
|
+
from notionary.page.notion_page import NotionPage
|
5
5
|
from notionary.util.logging_mixin import LoggingMixin
|
6
6
|
from notionary.util.page_id_utils import format_uuid
|
7
7
|
|
8
8
|
|
9
|
-
class
|
9
|
+
class NotionDatabase(LoggingMixin):
|
10
10
|
"""
|
11
11
|
Minimal manager for Notion databases.
|
12
12
|
Focused exclusively on creating basic pages and retrieving page managers
|
@@ -24,12 +24,12 @@ class NotionDatabaseManager(LoggingMixin):
|
|
24
24
|
self.database_id = format_uuid(database_id) or database_id
|
25
25
|
self._client = NotionClient(token=token)
|
26
26
|
|
27
|
-
async def create_blank_page(self) -> Optional[
|
27
|
+
async def create_blank_page(self) -> Optional[NotionPage]:
|
28
28
|
"""
|
29
29
|
Create a new blank page in the database with minimal properties.
|
30
30
|
|
31
31
|
Returns:
|
32
|
-
|
32
|
+
NotionPage for the created page, or None if creation failed
|
33
33
|
"""
|
34
34
|
try:
|
35
35
|
response = await self._client.post(
|
@@ -42,7 +42,7 @@ class NotionDatabaseManager(LoggingMixin):
|
|
42
42
|
"Created blank page %s in database %s", page_id, self.database_id
|
43
43
|
)
|
44
44
|
|
45
|
-
return
|
45
|
+
return NotionPage(page_id=page_id)
|
46
46
|
|
47
47
|
self.logger.warning("Page creation failed: invalid response")
|
48
48
|
return None
|
@@ -50,13 +50,13 @@ class NotionDatabaseManager(LoggingMixin):
|
|
50
50
|
except Exception as e:
|
51
51
|
self.logger.error("Error creating blank page: %s", str(e))
|
52
52
|
return None
|
53
|
-
|
53
|
+
|
54
54
|
async def get_pages(
|
55
55
|
self,
|
56
56
|
limit: int = 100,
|
57
57
|
filter_conditions: Optional[Dict[str, Any]] = None,
|
58
58
|
sorts: Optional[List[Dict[str, Any]]] = None,
|
59
|
-
) -> List[
|
59
|
+
) -> List[NotionPage]:
|
60
60
|
"""
|
61
61
|
Get all pages from the database.
|
62
62
|
|
@@ -66,7 +66,7 @@ class NotionDatabaseManager(LoggingMixin):
|
|
66
66
|
sorts: Optional sort instructions for the database query
|
67
67
|
|
68
68
|
Returns:
|
69
|
-
List of
|
69
|
+
List of NotionPage instances for each page
|
70
70
|
"""
|
71
71
|
self.logger.debug(
|
72
72
|
"Getting up to %d pages with filter: %s, sorts: %s",
|
@@ -75,7 +75,7 @@ class NotionDatabaseManager(LoggingMixin):
|
|
75
75
|
sorts,
|
76
76
|
)
|
77
77
|
|
78
|
-
pages: List[
|
78
|
+
pages: List[NotionPage] = []
|
79
79
|
count = 0
|
80
80
|
|
81
81
|
async for page in self.iter_pages(
|
@@ -99,7 +99,7 @@ class NotionDatabaseManager(LoggingMixin):
|
|
99
99
|
page_size: int = 100,
|
100
100
|
filter_conditions: Optional[Dict[str, Any]] = None,
|
101
101
|
sorts: Optional[List[Dict[str, Any]]] = None,
|
102
|
-
) -> AsyncGenerator[
|
102
|
+
) -> AsyncGenerator[NotionPage, None]:
|
103
103
|
"""
|
104
104
|
Asynchronous generator that yields pages from the database.
|
105
105
|
Directly queries the Notion API without using the schema.
|
@@ -110,7 +110,7 @@ class NotionDatabaseManager(LoggingMixin):
|
|
110
110
|
sorts: Optional sort instructions for the database query
|
111
111
|
|
112
112
|
Yields:
|
113
|
-
|
113
|
+
NotionPage instances for each page
|
114
114
|
"""
|
115
115
|
self.logger.debug(
|
116
116
|
"Iterating pages with page_size: %d, filter: %s, sorts: %s",
|
@@ -149,7 +149,7 @@ class NotionDatabaseManager(LoggingMixin):
|
|
149
149
|
|
150
150
|
page_url = f"https://notion.so/{page_id.replace('-', '')}"
|
151
151
|
|
152
|
-
notion_page_manager =
|
152
|
+
notion_page_manager = NotionPage(
|
153
153
|
page_id=page_id, title=title, url=page_url
|
154
154
|
)
|
155
155
|
yield notion_page_manager
|
@@ -220,4 +220,3 @@ class NotionDatabaseManager(LoggingMixin):
|
|
220
220
|
async def close(self) -> None:
|
221
221
|
"""Close the client connection."""
|
222
222
|
await self._client.close()
|
223
|
-
|
@@ -2,8 +2,8 @@ import logging
|
|
2
2
|
from typing import List, Optional, Dict, Any
|
3
3
|
from difflib import SequenceMatcher
|
4
4
|
|
5
|
-
from notionary.
|
6
|
-
from notionary.
|
5
|
+
from notionary.database.notion_database import NotionDatabase
|
6
|
+
from notionary.notion_client import NotionClient
|
7
7
|
from notionary.exceptions.database_exceptions import (
|
8
8
|
DatabaseConnectionError,
|
9
9
|
DatabaseInitializationError,
|
@@ -29,7 +29,7 @@ class NotionDatabaseFactory(LoggingMixin):
|
|
29
29
|
@classmethod
|
30
30
|
async def from_database_id(
|
31
31
|
cls, database_id: str, token: Optional[str] = None
|
32
|
-
) ->
|
32
|
+
) -> NotionDatabase:
|
33
33
|
"""
|
34
34
|
Create a NotionDatabaseManager from a database ID.
|
35
35
|
|
@@ -45,7 +45,7 @@ class NotionDatabaseFactory(LoggingMixin):
|
|
45
45
|
try:
|
46
46
|
formatted_id = format_uuid(database_id) or database_id
|
47
47
|
|
48
|
-
manager =
|
48
|
+
manager = NotionDatabase(formatted_id, token)
|
49
49
|
|
50
50
|
logger.info(
|
51
51
|
"Successfully created database manager for ID: %s", formatted_id
|
@@ -53,10 +53,8 @@ class NotionDatabaseFactory(LoggingMixin):
|
|
53
53
|
return manager
|
54
54
|
|
55
55
|
except DatabaseInitializationError:
|
56
|
-
# Re-raise the already typed exception
|
57
56
|
raise
|
58
57
|
except NotionDatabaseException:
|
59
|
-
# Re-raise other custom exceptions
|
60
58
|
raise
|
61
59
|
except Exception as e:
|
62
60
|
error_msg = f"Error connecting to database {database_id}: {str(e)}"
|
@@ -66,7 +64,7 @@ class NotionDatabaseFactory(LoggingMixin):
|
|
66
64
|
@classmethod
|
67
65
|
async def from_database_name(
|
68
66
|
cls, database_name: str, token: Optional[str] = None
|
69
|
-
) ->
|
67
|
+
) -> NotionDatabase:
|
70
68
|
"""
|
71
69
|
Create a NotionDatabaseManager by finding a database with a matching name.
|
72
70
|
Uses fuzzy matching to find the closest match to the given name.
|
@@ -86,13 +84,11 @@ class NotionDatabaseFactory(LoggingMixin):
|
|
86
84
|
try:
|
87
85
|
logger.debug("Using search endpoint to find databases")
|
88
86
|
|
89
|
-
# Create search query for databases
|
90
87
|
search_payload = {
|
91
88
|
"filter": {"property": "object", "value": "database"},
|
92
89
|
"page_size": 100,
|
93
90
|
}
|
94
91
|
|
95
|
-
# Perform search
|
96
92
|
response = await client.post("search", search_payload)
|
97
93
|
|
98
94
|
if not response or "results" not in response:
|
@@ -144,9 +140,9 @@ class NotionDatabaseFactory(LoggingMixin):
|
|
144
140
|
best_score,
|
145
141
|
)
|
146
142
|
|
147
|
-
manager =
|
143
|
+
manager = NotionDatabase(database_id, token)
|
148
144
|
|
149
|
-
logger.info(
|
145
|
+
logger.info("Successfully created database manager for '%s'", matched_name)
|
150
146
|
await client.close()
|
151
147
|
return manager
|
152
148
|
|
@@ -193,4 +189,4 @@ class NotionDatabaseFactory(LoggingMixin):
|
|
193
189
|
if "plain_text" in text_obj:
|
194
190
|
text_parts.append(text_obj["plain_text"])
|
195
191
|
|
196
|
-
return "".join(text_parts)
|
192
|
+
return "".join(text_parts)
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/content/page_content_manager.py
RENAMED
@@ -1,17 +1,15 @@
|
|
1
|
-
import re
|
2
1
|
from typing import Any, Dict, List, Optional
|
3
2
|
|
4
|
-
from notionary.
|
3
|
+
from notionary.notion_client import NotionClient
|
4
|
+
from notionary.converters.registry.block_element_registry import BlockElementRegistry
|
5
|
+
|
6
|
+
from notionary.converters.markdown_to_notion_converter import (
|
5
7
|
MarkdownToNotionConverter,
|
6
8
|
)
|
7
|
-
from notionary.
|
9
|
+
from notionary.converters.notion_to_markdown_converter import (
|
8
10
|
NotionToMarkdownConverter,
|
9
11
|
)
|
10
|
-
from notionary.
|
11
|
-
BlockElementRegistry,
|
12
|
-
)
|
13
|
-
from notionary.core.notion_client import NotionClient
|
14
|
-
from notionary.core.page.content.notion_page_content_chunker import (
|
12
|
+
from notionary.page.content.notion_page_content_chunker import (
|
15
13
|
NotionPageContentChunker,
|
16
14
|
)
|
17
15
|
from notionary.util.logging_mixin import LoggingMixin
|
{notionary-0.1.12/notionary/core → notionary-0.1.13/notionary}/page/metadata/metadata_editor.py
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Any, Dict, Optional
|
2
|
-
from notionary.
|
3
|
-
from notionary.
|
2
|
+
from notionary.notion_client import NotionClient
|
3
|
+
from notionary.page.properites.property_formatter import NotionPropertyFormatter
|
4
4
|
from notionary.util.logging_mixin import LoggingMixin
|
5
5
|
|
6
6
|
|