This is just a proof of concept. The idea is to render python code inside of a notion page using the new notion API. Just for fun!
- Create a new notion integration
- Create a copy of this page in your workspace
- Make sure to share your new page with your integration:
- Copy the page ID:
- Create the image and tag it:
> docker build . -t notion
- Run the command, make sure you have the integration token and the page ID
> docker run -it -v $(pwd):/usr/src/app notion python pynotion.py -t INTEGRATION_TOKEN -p PAGE_ID
Note: Every time you add something to the page you need to run the command to update it with the result. Unfortunately it is not real time :(
The last text found on your page is processed as Python code and the result is appended to the page
> ... pynotion -t INTEGRATION_TOKEN -p PAGE_ID -c run
The page is cleaned
> ... pynotion -t INTEGRATION_TOKEN -p PAGE_ID -c clean
- This is making use of the eval function so be careful with whom you share your notion page! They could do something like this (or worst):
- This "prompt" can't run any complex code such as classes or method definitions