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 NotionUtil
# notion page url
url = "https://www.notion.so/xxxx"
notion = NotionUtil()
markdown_content = notion.get_page_markdown(url, recursive=False)
print(markdown_content)
from notion_util import Notion, markdown_to_notion_blocks
notion = Notion()
# ここで、NotionのデータベースIDと新しいページのタイトルを指定する
database_id = os.getenv("DATABASE_ID")
page_title = "New Page From Markdown"
# Notionのプロパティを設定
properties = {"URL": {"url": "http://example.com"}}
# 新しいページを作成
res = notion.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ページにブロックを追加
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-1.2.1.tar.gz
(23.2 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-1.2.1.tar.gz.
File metadata
- Download URL: notion_util-1.2.1.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bba0015dd43bb88d913fc2089b54708140fdce2d5a1e89ebdb7cac815e5e68a1
|
|
| MD5 |
3ee29269fe6bbdb8243b96985af6cb1e
|
|
| BLAKE2b-256 |
e4d1a634133fbffad6bbf45ebfde6d58efcab03513fca8accd38493cb843c7fb
|
File details
Details for the file notion_util-1.2.1-py3-none-any.whl.
File metadata
- Download URL: notion_util-1.2.1-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82177f2473c044c8df4e75ce6d23bc1b08365bf4a27d003359ac5ec11383fed6
|
|
| MD5 |
0906ba62926a2493fed2bd7b963cbbbc
|
|
| BLAKE2b-256 |
857ba67202d38fbd7dc87882815c5ffd9e31e687a7fd4bb494e19bee47037037
|