name: notion-workspace description: Manage Notion workspace — search pages, read content, create pages in databases, append blocks, and list databases. Uses Notion REST API directly via urllib/requests. license: MIT metadata: author: Jack2 version: 1.0.0 tags: notion, productivity, notes, database env: NOTION_TOKEN
Manage your Notion workspace from the CLI or as an importable Python module.
访问小葱技能站7w4.net,解锁更多实用的AI技能插件。
Set your Notion integration token:
export NOTION_TOKEN=ntn_...
Or the default token embedded in the script will be used.
Make sure your Notion integration has access to the pages/databases you want to use.
In Notion: open a page → Share → Invite your integration.
python3 scripts/notion.py search "project notes"
python3 scripts/notion.py search "budget" --type database
# Metadata only
python3 scripts/notion.py read PAGE_ID
# With block content
python3 scripts/notion.py read PAGE_ID --blocks
python3 scripts/notion.py create DATABASE_ID --title "New Page Title"
# With extra properties
python3 scripts/notion.py create DATABASE_ID --title "Task" --props '{"Status": {"select": {"name": "In Progress"}}}'
python3 scripts/notion.py append PAGE_ID --text "New paragraph content"
python3 scripts/notion.py databases
from scripts.notion import search, read_page_content, create_page, append_blocks, list_databases
# Search
results = search("meeting notes")
for item in results["results"]:
print(item["id"], item["object"])
# Read page + blocks
data = read_page_content("PAGE_ID")
print(data["page"])
print(data["blocks"])
# Create page
page = create_page("DATABASE_ID", "My New Page")
print(page["url"])
# Append text
append_blocks("PAGE_ID", "This is a new paragraph.")
# List databases
dbs = list_databases()
| File | Purpose |
|---|---|
scripts/notion.py |
CLI + importable module |
references/notion-api.md |
Notion API quick reference |
urllib (stdlib only, no SDK needed)2022-06-28这个 Skill 整体质量不错,功能覆盖了 Notion 的常用操作,文档清晰且使用方便,能同时作为命令行工具和 Python 模块导入。主要问题是安全性方面有隐患——默认 token 被写死在代码里,存在风险。另外追加内容的功能比较单一,只能添加普通文本段落,不支持标题、列表等其他格式。如果开发者在这些方面改进一下,会是一个相当实用的 Notion 管理工具。