Skip to content

This is an experiment to render python code inside of a notion page using the new notion API. Just for fun!

License

Notifications You must be signed in to change notification settings

kevteg/notion-python-prompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notion Python prompt!

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!

Python prompt on notion

Seting up the notion page

Notion share modal

  • Copy the page ID:

Example image of the page ID

Running using docker

  • 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 :(

Available commands

Run code: (Default)

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

Clean page:

The page is cleaned

> ... pynotion -t INTEGRATION_TOKEN -p PAGE_ID -c clean

Warning

  • 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): image
  • This "prompt" can't run any complex code such as classes or method definitions

About

This is an experiment to render python code inside of a notion page using the new notion API. Just for fun!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published