Skip to main content

A package to interact with the Notion API

Project description

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

Pages

  • Create a page
  • Search for pages
  • Get a page by id
  • Update a page
  • Delete a page

Blocks

  • Create a block

Installation

pip install secnex-notion-api

Usage

from secnex_notion_api.api.client import NotionApiClient
from secnex_notion_api.page import NotionPage
from secnex_notion_api.block import NotionParagraph

import os

client = NotionApiClient(token=os.getenv("NOTION_API_KEY"))

def main():
    pages = client.search(query="Site Name", filter={"value": "page", "property": "object"})
    print(pages)

    page_id = pages["results"][0]["id"]
    print(page_id)
    page = client.get_page_by_id(page_id)
    print(page)

    paragraph = NotionParagraph(parent_type="page", text=["Hello, world!"])
    page = NotionPage(parent={"page_id": page_id}, title="Hello, world!", blocks=[paragraph], properties=pages["results"][0]["properties"])
    print(page)
    print(client.new(page))

if __name__ == "__main__":
    main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

secnex_notion_api-0.0.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

secnex_notion_api-0.0.3-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file secnex_notion_api-0.0.3.tar.gz.

File metadata

  • Download URL: secnex_notion_api-0.0.3.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for secnex_notion_api-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e61b611358ebb973da434b9debadba8d25ed7e8768979bb0f4b016c8eaf00f8f
MD5 76eb7e7d0edc244d2c2e5d93628cdf0e
BLAKE2b-256 8a1d3b0cc02e0ed63bbbc47186c0cbffd8b5f8590a6a454f08c707de7470d698

See more details on using hashes here.

File details

Details for the file secnex_notion_api-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for secnex_notion_api-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b7c8d3e1161a3b96a1df06f51155abb53837d6ba31756acb91e8d8fcb81587c3
MD5 c66f79459408f774af175c07e49f1903
BLAKE2b-256 a83b3d016a613f511655d1c5130b44bc0bfdd13737ba9c7f76dc88d34d279578

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page