Skip to main content

Unofficial Python API client for Notion.so

Project description

Notion Util

このプロジェクトは、Notion.soの非公式Python APIクライアントです。 NotionページのMarkdown変換やNotion Databaseのcsv変換が可能です。

インストール

このパッケージをインストールするには、以下のコマンドを実行してください。

pip install notion-util

使い方

export NOTION_SECRET=secret_xxxxxxxxxxxx
from notion.util import get_page_markdown
# notion page url
url = "https://www.notion.so/xxxx"
# ページのブロックを取得
markdown_content = get_page_markdown(url, recursive=False)
print(markdown_content)
from notion.util import create_notion_page, markdown_to_notion_blocks, append_blocks_to_page

# ここで、NotionのデータベースIDと新しいページのタイトルを指定する
database_id = os.getenv("DATABASE_ID")
page_title = "New Page From Markdown"
# Notionのプロパティを設定
properties = {"URL": {"url": "http://example.com"}}
# 新しいページを作成
res = create_notion_page(database_id, page_title, properties)
# Markdownファイルを読み込む
with open("README.md", "r") as md_file:
    # MarkdownをNotionブロックに変換
    blocks = markdown_to_notion_blocks(md_file.read())
    # Notionページにブロックを追加
    append_blocks_to_page(res["id"], blocks)

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

notion-util-0.0.3.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

notion_util-0.0.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file notion-util-0.0.3.tar.gz.

File metadata

  • Download URL: notion-util-0.0.3.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for notion-util-0.0.3.tar.gz
Algorithm Hash digest
SHA256 6855180ea66f3e45cc449fa7eee9ce565d8a9532b8f3975048dce1647f1bce44
MD5 ea3cd48e0dfc631f976fd6f0335ce53b
BLAKE2b-256 e3d9e20f92a6521dfdbcfc23bf9c92fcf554e3fe4a2935433eac5232129eed3e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: notion_util-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for notion_util-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 48cf25976e512f4eebe7e09f2bd0d70c62209817615481a13be5a9e9dfdad8e7
MD5 7a21e9694d91b53c72a52dd912a070b4
BLAKE2b-256 a5b58f96220ad22df6943fcedd25fd4b2c345f20163a1ef0d0a6277ee6e01255

See more details on using hashes here.

Supported by

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