notionary 0.1.5__tar.gz → 0.1.6__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.
Files changed (51) hide show
  1. {notionary-0.1.5 → notionary-0.1.6}/PKG-INFO +1 -1
  2. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/page/meta_data/metadata_editor.py +21 -0
  3. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/page/notion_page_manager.py +23 -1
  4. {notionary-0.1.5 → notionary-0.1.6}/notionary.egg-info/PKG-INFO +1 -1
  5. {notionary-0.1.5 → notionary-0.1.6}/setup.py +1 -1
  6. {notionary-0.1.5 → notionary-0.1.6}/LICENSE +0 -0
  7. {notionary-0.1.5 → notionary-0.1.6}/README.md +0 -0
  8. {notionary-0.1.5 → notionary-0.1.6}/notionary/__init__.py +0 -0
  9. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/__init__.py +0 -0
  10. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/bookmark_element.py +0 -0
  11. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/callout_element.py +0 -0
  12. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/code_block_element.py +0 -0
  13. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/column_element.py +0 -0
  14. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/divider_element.py +0 -0
  15. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/heading_element.py +0 -0
  16. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/image_element.py +0 -0
  17. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/list_element.py +0 -0
  18. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/notion_block_element.py +0 -0
  19. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/paragraph_element.py +0 -0
  20. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/qoute_element.py +0 -0
  21. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/table_element.py +0 -0
  22. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/text_inline_formatter.py +0 -0
  23. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/todo_lists.py +0 -0
  24. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/toggle_element.py +0 -0
  25. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/elements/video_element.py +0 -0
  26. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/markdown_to_notion_converter.py +0 -0
  27. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/notion_to_markdown_converter.py +0 -0
  28. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/registry/block_element_registry.py +0 -0
  29. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/converters/registry/block_element_registry_builder.py +0 -0
  30. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/database/database_info_service.py +0 -0
  31. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/database/database_query_service.py +0 -0
  32. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/database/database_schema_service.py +0 -0
  33. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/database/models/page_result.py +0 -0
  34. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/database/notion_database_manager.py +0 -0
  35. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/database/notion_database_manager_factory.py +0 -0
  36. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/database/notion_database_schema.py +0 -0
  37. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/database/notion_database_writer.py +0 -0
  38. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/database/page_service.py +0 -0
  39. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/notion_client.py +0 -0
  40. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/page/page_content_manager.py +0 -0
  41. {notionary-0.1.5 → notionary-0.1.6}/notionary/core/page/property_formatter.py +0 -0
  42. {notionary-0.1.5 → notionary-0.1.6}/notionary/exceptions/database_exceptions.py +0 -0
  43. {notionary-0.1.5 → notionary-0.1.6}/notionary/exceptions/page_creation_exception.py +0 -0
  44. {notionary-0.1.5 → notionary-0.1.6}/notionary/util/logging_mixin.py +0 -0
  45. {notionary-0.1.5 → notionary-0.1.6}/notionary/util/singleton_decorator.py +0 -0
  46. {notionary-0.1.5 → notionary-0.1.6}/notionary/util/uuid_utils.py +0 -0
  47. {notionary-0.1.5 → notionary-0.1.6}/notionary.egg-info/SOURCES.txt +0 -0
  48. {notionary-0.1.5 → notionary-0.1.6}/notionary.egg-info/dependency_links.txt +0 -0
  49. {notionary-0.1.5 → notionary-0.1.6}/notionary.egg-info/requires.txt +0 -0
  50. {notionary-0.1.5 → notionary-0.1.6}/notionary.egg-info/top_level.txt +0 -0
  51. {notionary-0.1.5 → notionary-0.1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionary
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: A toolkit to convert between Markdown and Notion blocks
5
5
  Home-page: https://github.com/mathisarends/notionary
6
6
  Author: Mathis Arends
@@ -1,3 +1,4 @@
1
+ import random
1
2
  from typing import Any, Dict, Optional
2
3
  from notionary.core.notion_client import NotionClient
3
4
  from notionary.util.logging_mixin import LoggingMixin
@@ -35,3 +36,23 @@ class MetadataEditor(LoggingMixin):
35
36
  f"pages/{self.page_id}",
36
37
  {"cover": {"type": "external", "external": {"url": external_url}}},
37
38
  )
39
+
40
+ async def set_random_gradient_cover(self) -> Optional[Dict[str, Any]]:
41
+ """
42
+ Sets a random gradient cover from Notion's default gradient covers.
43
+
44
+ Returns:
45
+ Optional[Dict[str, Any]]: The API response or None if the operation fails
46
+ """
47
+ default_notion_covers = [
48
+ "https://www.notion.so/images/page-cover/gradients_8.png",
49
+ "https://www.notion.so/images/page-cover/gradients_2.png",
50
+ "https://www.notion.so/images/page-cover/gradients_11.jpg",
51
+ "https://www.notion.so/images/page-cover/gradients_10.jpg",
52
+ "https://www.notion.so/images/page-cover/gradients_5.png",
53
+ "https://www.notion.so/images/page-cover/gradients_3.png"
54
+ ]
55
+
56
+ random_cover_url = random.choice(default_notion_covers)
57
+
58
+ return await self.set_cover(random_cover_url)
@@ -105,10 +105,21 @@ class NotionPageManager(LoggingMixin):
105
105
  self, emoji: Optional[str] = None, external_url: Optional[str] = None
106
106
  ) -> Optional[Dict[str, Any]]:
107
107
  return await self._metadata.set_icon(emoji, external_url)
108
+
109
+ async def get_cover_url(self) -> str:
110
+ page_data = await self._client.get_page(self._page_id)
111
+
112
+ if not page_data:
113
+ return ""
114
+
115
+ return page_data.get("cover", {}).get("external", {}).get("url", "")
108
116
 
109
117
  async def set_page_cover(self, external_url: str) -> Optional[Dict[str, Any]]:
110
118
  return await self._metadata.set_cover(external_url)
111
119
 
120
+ async def set_random_gradient_cover(self) -> Optional[Dict[str, Any]]:
121
+ return await self._metadata.set_random_gradient_cover()
122
+
112
123
  async def get_properties(self) -> Dict[str, Any]:
113
124
  """Retrieves all properties of the page"""
114
125
  page_data = await self._client.get_page(self._page_id)
@@ -126,4 +137,15 @@ class NotionPageManager(LoggingMixin):
126
137
  properties = await self.get_properties()
127
138
  if "Status" in properties and properties["Status"].get("status"):
128
139
  return properties["Status"]["status"]["name"]
129
- return None
140
+ return None
141
+
142
+
143
+ async def main():
144
+ page_manager = NotionPageManager(page_id="https://notion.so/1d0389d57bd3805cb34ccaf5804b43ce")
145
+ cover_url = await page_manager.get_cover_url()
146
+ print(f"Cover URL: {cover_url}")
147
+
148
+
149
+ if __name__ == "__main__":
150
+ import asyncio
151
+ asyncio.run(main())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionary
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: A toolkit to convert between Markdown and Notion blocks
5
5
  Home-page: https://github.com/mathisarends/notionary
6
6
  Author: Mathis Arends
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name="notionary",
5
- version="0.1.5",
5
+ version="0.1.6",
6
6
  packages=find_namespace_packages(include=["notionary*"]),
7
7
  install_requires=[
8
8
  "notion-client>=2.0.0",
File without changes
File without changes
File without changes