Quick Start
from notion import Client, Components, Properties
import os
def main():
client = Client(token=os.getenv("NOTION_API_KEY"))
template_page = client.search(query="Tickets", filter={"property": "object", "value": "database"})
page = Components.Page(
parent=template_page["results"][0],
parent_type="database",
icon="👋",
properties=[
Properties.Property(field="Name", value="Test"),
Properties.Checkbox(field="Checkbox", value=True),
Properties.MultiSelect(field="Multi-select", value=[
Properties.MultiSelectOption(name="Test"),
Properties.MultiSelectOption(name="Test One", color="blue")
]),
Properties.Select(field="Priority", value=Properties.SelectOption(name="Wow", color="blue"))
],
blocks=[
Components.Paragraph(text=["Hello, world!"]),
Components.Callout(text="Hello, world!", icon="👋", color="default")
]
)
print(client.new(page))
if __name__ == "__main__":
main()