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.1.0.tar.gz
(19.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-1.1.0.tar.gz.
File metadata
- Download URL: notion_util-1.1.0.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66a02340b7f534ba321209613bc8b78f2a439a179f10c1c98f8807825dba3ab4
|
|
| MD5 |
4b9fc7491ebbce8e757f066fc0081dfc
|
|
| BLAKE2b-256 |
48dbd2f11e1394205ae98e012093d8354d1159977f5f219d2e2e38b5893b2f61
|
File details
Details for the file notion_util-1.1.0-py3-none-any.whl.
File metadata
- Download URL: notion_util-1.1.0-py3-none-any.whl
- Upload date:
- Size: 17.1 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 |
fc17c2dee33a5b4aff15981cc071f5864b98e655ed272eceb73671fea4bf0b2d
|
|
| MD5 |
e0d133ae3998ab3e2532df56696e8319
|
|
| BLAKE2b-256 |
2cd4de446b803568dcae34a36039d1ab0bb7a4ff864696d768997a8b6f0bf37e
|