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.2.tar.gz
(6.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file notion-util-0.0.2.tar.gz.
File metadata
- Download URL: notion-util-0.0.2.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b07a6ba996d27994cc57350595489b71cb22261ceed43c7aa6a0183b02856328
|
|
| MD5 |
a54cefdd18c65b3fb4d0e7ca4f03ee56
|
|
| BLAKE2b-256 |
82a13a3c2ecda0dddc593441c9cb3a4f48c15ab3e475f2d0e94bda4e98e85f8f
|
File details
Details for the file notion_util-0.0.2-py3-none-any.whl.
File metadata
- Download URL: notion_util-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fc311e5db465d6f9b1c3c5a95a8e304d3b12f68c743f4a71c62488aecac237c
|
|
| MD5 |
c79d29c60780e317cc1dca0a0873cc3d
|
|
| BLAKE2b-256 |
9ec841f0d402b6c6b32516c5b21ae093edd545e8e64c5769cf60400a4905befd
|