示例#1
0
def test_block_append(notion_token):
    notion_api = NotionApi(token=notion_token)
    test_page = get_test_page()

    block = test_page.children.add_new(TextBlock, title="test block append")
    new_block = notion_api.block_append(block.id, {"title": "appending text"})

    assert new_block == {"id": new_block.block.id, "title": "appending text"}
    assert new_block.block.parent.id == block.id
示例#2
0
def block_append(notion_token, block_id):
    try:
        notion_api = NotionApi(notion_token)

        block = notion_api.block_append(block_id, request.json['text'])

        return jsonify(block_id=block.id), 200
    except Exception as error:
        return jsonify(error=str(error)), 500