Page
page
¶
Functionality around Notion pages.
Page(*args: Any, **kwargs: Any)
¶
A Notion page.
Attributes:
Name | Type | Description |
---|---|---|
props | PagePropertiesNS | accessor for all page properties |
cover: FileInfo | None
property
writable
¶
Cover of the page.
icon: FileInfo | Emoji | None
property
writable
¶
Icon of the page, i.e. emojis, Notion's icons, or custom images.
in_db: bool
property
¶
Return True if this page is located in a database.
is_page: bool
property
¶
Return whether the object is a page.
parent_db: Database | None
property
¶
If this page is located in a database return the database or None otherwise.
This is a convenience method to avoid the need to check and cast the type of the parent.
props: PagePropertiesNS
instance-attribute
¶
public_url: str | None
property
¶
Return the public URL of this database.
subdbs: list[Database]
property
¶
Return all contained databases within this page
subpages: list[Page]
property
¶
Return all contained pages within this page
title: Text
property
writable
¶
Title of the page.
url: str
property
¶
Return the URL of this page.
__repr__() -> str
¶
__str__() -> str
¶
delete() -> Self
¶
Delete this page.
Warning
Deleting a page will also delete all child pages and child databases recursively. If these objects are already cached in the session, they will not be updated. Use session.cache.clear()
to clear the cache or call reload()
on them.
reload() -> Self
¶
Reload this page.
restore() -> Self
¶
Restore this page.
show(*, simple: bool | None = None)
¶
Show the content of the page, rendered in JupyterLab
to_html(*, raw: bool = False) -> str
¶
Return the content of the page as HTML.
to_markdown() -> str
¶
Return the content of the page as Markdown.
Note
This will not include nested blocks, i.e. the children of top-level blocks.
wrap_obj_ref(obj_ref: obj_blocks.Page) -> Self
classmethod
¶
PagePropertiesNS(page: Page)
¶
Namespace of the properties of a page as defined in the schema of the database.
This defines the .props
namespace of a page page
and updates the content on the Notion server side in case of an assignment. Access the properties with page.props.property_name
or page.props['Property Name']
.
PageProperty(prop_name: str)
¶
is_db_guard(obj: DataObject | None) -> TypeGuard[Database]
¶
Return whether the object is a database as type guard.
is_page_guard(obj: DataObject | None) -> TypeGuard[Page]
¶
Return whether the object is a page as type guard.