Skip to content

SecNex/notion-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SecNex Notion API Wrapper

This is a wrapper for the Notion API. You can use it to create, update, and delete pages, blocks, and more.

Features

Blocks

  • Paragraph
  • Callout
  • Headings
  • Code
  • Image
  • Video
  • File
  • To-do
  • Toggle
  • Table
  • Divider

Properties

  • Property
  • Checkbox
  • Multi-select
  • Select
  • Text
  • Title
  • Description

Pages

Installation

pip install secnex-notion-api

Usage

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()

About

API wrapper for Notion to automate your Notion workspace and workflows

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages