Generate a roam research like network graph view from your Notion pages.
Project description
Notion Graph View
Export Notion pages to a Roam-Research like graph view.
📜 Usage
Environment
- Python >= 3.9
Installing
pip install notion-graph
Notion API Setup
-
Create a notion internal integration and generate an
Internal Integration Token
. -
Open one notion page on the browser, select "Add connections" and add your integration account.
-
Find your base
Page
ID` from the browser URL, for example:
if page url is: https://www.notion.so/yourName/PageTitle-8a4b5ff100d648fb8d39d4bfa756ff3f,
8a4b5ff100da48fb8d39d4bfa756ff3f
is thePage ID
Quickly Running
python -m notion_graph -p <Page ID> -t <Integration Token> -o <file path to export>
For instance,
python -m notion_graph -p 856391c93ae64bd1b7ebf699ca0cd861 -t secret_b8p7uLp3j3n95IDgofC9GviXP111Skx6NOt2d20U8e -o ./graph_out.html
graph_out.html
would be generated at your specific path.
Importing as a Python Library
You can also import notion_graph
as a library.
For instance, draw your diagram in Jupyter Notebook.
import notion_graph as ng
my_ng = ng.NotionGraph(bearer_token="secret_b8p7uLp3j3n95IDgofC9GviXP111Skx6NOt2d20U8e")
network = my_ng.parse(page_id="856391c93ae64bd1b7ebf699ca0cd861")
# `network` is a `pyvis.network.Network` object, see more attributes: https://pyvis.readthedocs.io/en/latest/documentation.html
network.repulsion(node_distance=200, spring_length=200)
# this line is for jupeter notebook only
network.prep_notebook()
network.show("graph.html")
Testing Environment
The testing page is Notion-graph-view-demo. You can duplicate the page to your Notion account and run the project to test if everything goes well.
Development Guide
This project's dependencies are managed by PDM.
brew install pdm
pdm install
Running the project by:
pdm run start -p <page_id> -t <notion_token> -o ./graph_out.html
🔗 Supported Links
database | page | |
---|---|---|
paragraph | ✔️ | ✔️ |
bulleted_list_item | ✔️ | ✔️ |
numbered_list_item | ✔️ | ✔️ |
to_do | ✔️ | ✔️ |
toggle | ✔️ | ✔️ |
child_page | ✔️ | ✔️ |
child_database | ✔️ | ✔️ |
embed | ||
callout | ✔️ | ✔️ |
quote | ✔️ | ✔️ |
heading_1 | ✔️ | ✔️ |
heading_2 | ✔️ | ✔️ |
heading_3 | ✔️ | ✔️ |
column | ✔️ | ✔️ |
column_list | ✔️ | ✔️ |
synced_block | ||
link_to_page | ||
table | ✔️ | ✔️ |
table_row | ✔️ | ✔️ |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file notion-graph-0.2.6.tar.gz
.
File metadata
- Download URL: notion-graph-0.2.6.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.8.0a2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 071d80211e702ff8bfb2dbf34665e77201bf3148192944c5d46adf057e5b9f1c |
|
MD5 | d7bf5807d97dbf7adcc3c1e3f3b2328a |
|
BLAKE2b-256 | d83d51c25919d0ee68cb43f559edee74b369f421d1bd7a841849cad3d23090e9 |
File details
Details for the file notion_graph-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: notion_graph-0.2.6-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.8.0a2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b1b34f8396471dc2b038bf30d068be47abf5d644be0d4aa1d2d489a47a40e88 |
|
MD5 | 280846acd81d74bece096205723c76da |
|
BLAKE2b-256 | ace8810b1425fcebde27cccef431be10e4d11753c279753927e7beaed5733f0c |