1#to install the api use:
2#pip install notion-py
3
4from notion.client import NotionClient
5
6# Obtain the `token_v2` value by inspecting your browser
7# cookies on a logged-in (non-guest) session on Notion.so
8client = NotionClient(token_v2="123123...")
9
10# Replace this URL with the URL of the page you want to edit
11page = client.get_block("https://www.notion.so/myorg/Test-c0d20a71c0944985ae96e661ccc99821")
12
13print("The old title is:", page.title)
14
15# You can use Markdown! We convert on-the-fly
16# to Notion's internal formatted text data structure.
17page.title = "The title has now changed, and has *live-updated* in the browser!"
18