This project is about me getting know Notion HTTP API. The practical task is to visualize tasks dependencies graph withing specific project.
- Fetch all tasks (pages) within specific project (database) via Notion HTTP API
- Build dependency graph (I expect tasks to have "Depends on"/"Dependency for" properties of "relation" type).
- Generate graph in dot format.
- Render dependency graph via graphviz tool
There should be config.json
file (will be ignored by git) with following content:
{
"notion_token": "secret_ABCDXXXYYYZZZ",
"database_id": "123abc456efg"
}
./main.py && open steps.png
Graph file is in dot format (original file):
digraph {
"Do something first" -> "Huge blocker";
"Last step\ntoward finish";
"Something" -> "Last step\ntoward finish";
"Something else" -> "Last step\ntoward finish";
"do this";
"[Person1] important stuff";
"[Person2] important stuff";
"Pre-requisite" -> "[Person2] important stuff";
"Pre-requisite" -> "[Person1] important stuff";
"Pre-requisite" -> "do this";
"Huge blocker" -> "Something else";
"Huge blocker" -> "Something";
"Huge blocker" -> "[Person1] important stuff";
"Huge blocker" -> "[Person2] important stuff";
"Single thing to be done";
}
- dot executable - part of graphviz package
For convenience there is a Heroku-compatible web application that could be deployed and accessible from web.
There should be few config variables set up:
BASIC_AUTH_PASSWORD
will be used to restrict access to app via basic auth.BASIC_AUTH_USER
same as previous, will be used to restrict access to app via basic auth.DATABASE_ID
will be used for tasks scrapping. Seenotion_token
configuration key in previous sections of this README.NOTION_TOKEN
will be used for tasks scrapping. Seedatabase_id
configuration key in previous sections of this README.
There should be the heroku-community/apt
buildpack enabled. You could enable it in settings tab of Heroku dashboard:
push button "Add buildback" and enter heroku-community/apt
.
Run following snippet and open http://localhost:8080
export BASIC_AUTH_USER=user
export BASIC_AUTH_PASSWORD=password
export DATABASE_ID=database_id
export NOTION_TOKEN=notion_token
python app.py