Notion助手

👤 534422530 📦 v1.0.0 ⭐ 3.9 ⬇️ 565 下載
📚 知識管理 免費 🔑 需 API Key

📖 技能介紹


name: notion-helper description: Notion API助手 - 建立和管理Notion頁面、資料庫,支援筆記和知識管理。 metadata: {"openclaw": {"requires": {"python": ["notion-client"]}, "install": []}} tags: [notion, notes, database, knowledge, api] version: 1.0.0 author: laosi source: adapted


Notion Helper - Notion助手

啟用詞: Notion / 筆記管理 / 知識庫

安裝

pip install notion-client

獲取API金鑰

  1. 訪問 https://www.notion.so/my-integrations
  2. 建立新整合
  3. 複製API金鑰
  4. 分享資料庫給整合

Python實現

from notion_client import AsyncClient
import asyncio

class NotionHelper:
    def __init__(self, token: str):
        self.client = AsyncClient(auth=token)

    async def create_page(self, parent_id: str, title: str, content: str = ""):
        await self.client.pages.create(
            parent={"database_id": parent_id},
            properties={
                "title": {
                    "title": [{"text": {"content": title}}]
                }
            },
            children=[{
                "object": "block",
                "type": "paragraph",
                "paragraph": {
                    "rich_text": [{"type": "text", "text": {"content": content}}]
                }
            }]
        )

    async def query_database(self, db_id: str, filter_props: dict = None):
        params = {"database_id": db_id}
        if filter_props:
            params["filter"] = filter_props
        return await self.client.databases.query(**params)

    async def update_page(self, page_id: str, properties: dict):
        await self.client.pages.update(page_id, properties=properties)

    async def get_page(self, page_id: str):
        return await self.client.pages.retrieve(page_id)

    async def search(self, query: str):
        return await self.client.search(query)

使用示例

async def main():
    helper = NotionHelper("secret_xxx")

    # 建立頁面
    await helper.create_page(
        parent_id="database_id",
        title="AI學習筆記",
        content="今天學習了機器學習..."
    )

    # 搜尋頁面
    results = await helper.search("AI")
    for page in results['results']:
        print(page['title'])

    # 查詢資料庫
    pages = await helper.query_database("database_id")
    for page in pages['results']:
        print(page['properties']['title']['title'][0]['text']['content'])

asyncio.run(main())

資料型別

型別 說明
title 標題
rich_text 文本
number 數字
checkbox 核取方塊
select 單選
multi_select 多選
date 日期
url 連結
email 郵箱
phone_number 電話

使用場景

  1. 知識庫管理
  2. 任務跟蹤

    本技能來自小蔥技能站7w4.net。

  3. 筆記整理
  4. 專案管理

🤖 AI 評測

這個工具能幫助管理Notion筆記,提供了基本的操作指南,質量中等偏上。優點是文件清晰完整,功能覆蓋面全,有實際可參考的使用示例。不足之處在於程式碼以示例為主,缺少完整實現檔案,高階功能支援有限。對於想快速上手Notion API的使用者來說有一定參考價值,但複雜場景下可能需要額外學習。適合作為入門級參考,但深度和實用性有待提升。

📊 多維度評分

適應性3.8
規範性3.9
有效性4.1
可靠性3.4
可信度4.5

📁 包含檔案 (2 個)

📄 SKILL.md 2.8 KB
📄 _meta.json 131 B