示例#1
0
def block_children_view(notion_token, block_id):
    try:
        notion_api = NotionApi(notion_token)

        content = notion_api.block_children(block_id)

        return jsonify(content), 200
    except Exception as error:
        return jsonify(error=str(error)), 500
示例#2
0
def test_block_children(notion_token):
    notion_api = NotionApi(token=notion_token)
    test_page = get_test_page()

    block = test_page.children.add_new(TextBlock, title="a parent block")
    child_block_1 = block.children.add_new(TextBlock, title="child block 1")
    child_block_2 = block.children.add_new(TextBlock, title="child block 2")

    content = notion_api.block_children(block.id)

    assert content[0] == {"id": child_block_1.id, "title": "child block 1"}
    assert content[1] == {"id": child_block_2.id, "title": "child block 2"}