Generate a roam research like Network Graph view from your Notion pages.

Overview

Notion Graph View

Export Notion pages to a Roam Research like graph view.

How to use it

Install dependencies with pipenv or pip:

pip install
# or
pipenv install

Login notion.so and get token_v2 from browser (How?). Paste it to config.py>my_token_v2.

Paste the page url which your want to analyse into config.py>my_url.

Then run:

python main.py

Finally graph_view.html will be generated at the current path, open it with any browser.

Todo

  • Read Notion pages, export to graph view image
  • Embedded into Notion Enhancer
Comments
  • requests.exceptions.HTTPError: Invalid input - message

    requests.exceptions.HTTPError: Invalid input - message

    D:\PycharmProjects\notion-graph-view\venv\Scripts\python.exe D:/PycharmProjects/notion-graph-view/main.py Root Page: Personal Home page Personal Home Traceback (most recent call last): File "D:\PycharmProjects\notion-graph-view\main.py", line 30, in read_page(config2.my_token_v2, config2.my_url) File "D:\PycharmProjects\notion-graph-view\main.py", line 17, in read_page bfs_block(base_block) File "D:\PycharmProjects\notion-graph-view\main.py", line 24, in bfs_block parser = Parser(block) File "D:\PycharmProjects\notion-graph-view\parser2.py", line 15, in init self.parse_page(block) File "D:\PycharmProjects\notion-graph-view\parser2.py", line 85, in parse_page self.parse_children(page) File "D:\PycharmProjects\notion-graph-view\parser2.py", line 74, in parse_children self.parse_collection(collection) File "D:\PycharmProjects\notion-graph-view\parser2.py", line 45, in parse_collection row_blocks = collection.get_rows() File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\notion\collection.py", line 239, in get_rows return self.query(**kwargs) File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\notion\collection.py", line 236, in query return CollectionQuery(self, self._get_a_collection_view(), **kwargs).execute() File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\notion\collection.py", line 385, in execute self._client.query_collection( File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\notion\client.py", line 294, in query_collection return self._store.call_query_collection(*args, **kwargs) File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\notion\store.py", line 344, in call_query_collection response = self._client.post("queryCollection", data).json() File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\notion\client.py", line 260, in post raise HTTPError( requests.exceptions.HTTPError: Invalid input.

    Process finished with exit code 1

    opened by AJJCAIRNS 7
  • Question: more link support?

    Question: more link support?

    Hello, @stevedsun! I've just stumbled across this project, great stuff!

    I was wondering, are these link types on the roadmap, or not supported because some kind of limitation?

    • embed
    • callout
    • quote
    • column
    • column_list
    • synced_block
    • link_to_page
    • table_row

    I saw that lib was updated from using client to using SDK, and I can imagine these types of links weren't possible to track using token_v2.

    Is it still impossible to track with data from an SDK or now it can be implemented? If it's possible, I would be happy to collaborate!

    opened by Bobronium 3
  • Could not find block with ID ****

    Could not find block with ID ****

    Once running main.py

    /notion-graph-view/env/lib/python3.10/site-packages/notion_client/client.py", line 126, in _parse_response raise APIResponseError(response, body["message"], code) notion_client.errors.APIResponseError: Could not find block with ID: **************************. Make sure the relevant pages and databases are shared with your integration.

    I could not find the option to share the specific page with an integration. How can this be done?

    opened by bartrietveld 2
  • Getting runtime error even after providing credentials

    Getting runtime error even after providing credentials

    I am really trying to make this work. However, I am getting error when launching main.py. When I run config.py I get runtime error saying that I have not entered by credentials but in fact I have. Can anyone help? Thank you.

    opened by ocean2196 2
  • Authorisation problem - can you please help?

    Authorisation problem - can you please help?

    Traceback (most recent call last): File "D:\PycharmProjects\notion-graph-view\main.py", line 26, in read_page(my_token_v2, my_url) File "D:\PycharmProjects\notion-graph-view\main.py", line 10, in read_page
    client = NotionClient(token_v2=token_v2) File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\notion\client.p y", line 95, in init self._update_user_info() File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\notion\client.p y", line 126, in _update_user_info records = self.post("loadUserContent", {}).json()["recordMap"] File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\notion\client.p y", line 265, in post response.raise_for_status() File "D:\PycharmProjects\notion-graph-view\venv\lib\site-packages\requests\models .py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://www. notion.so/api/v3/loadUserContent

    opened by AJJCAIRNS 1
  • Allow to keep credentials in a separate file

    Allow to keep credentials in a separate file

    • Updated config.py, so it will look for it in credentials.py
    • Created credentials.py.tmpl
    • Added credentials.py to .gitignore
    • Updated readme accordingly
    opened by Bobronium 0
  • updating the pip install command suggestion

    updating the pip install command suggestion

    I'm not very familiar with Python and had to do some google to initialize the project. Couldn't find easy instructions for pipenv to work, so I figured out how to use pip install ./requirements.txt instead. This may help others starting out with the project.

    opened by RayRemnant 0
  • support for cycles

    support for cycles

    ahoy! thank you so much for creating this repo!

    as far as I can tell, the graph view doesn't depict cycles, even if they exist in the underlying notion DB

    Would you be able to point me to which pieces of the repo would need to be tweaked to make this possible? I'd be happy to give this a whirl with a little guidance

    opened by lowellbander 0
  • Added Relation property support and Link to pages in rich text support

    Added Relation property support and Link to pages in rich text support

    If there is a link to a page in a relation property or a link in a rich text, the relation will be picked up by the graph.

    To get the relation from a link in a rich text, I remove the leading / of the href to get the page UID, then I try to get the page from the api. If there is an exception, I assume the href was not a link to a notion page and move on.

    I had to implement a singleton that logs the relations created to avoid infinite loops. All parsers that need to log the relation will need to get the id of the parent that calls the parser. It is required by the relation logger.

    I'm not sure the API call to retrieve the page is necessary, we can probably just call BlockParser after we add the relation to the logger. I'll try it later and push the improvement.

    Another area of improvement is the spacing of the nodes that are related. The edges overlap other edges where it could be avoided.

    I also took the liberty of changing the name of parser.py so that it doesn't override the parser module from stdlib as warned by Pylance.

    I don't know python so there is certainly a lot of room for improvement, feel free to point out anything that you would like me to fix or clarify.

    opened by Dylfaen 0
  • Traceback error

    Traceback error

    Hello! Did everything as instructed, getting these errors, please advise! thank you!

    Traceback (most recent call last): File "C:\Users###\Desktop\notion\main.py", line 1, in from parser import BlockParser File "C:\Users###\Desktop\notion\parser.py", line 2, in from config import notion File "C:\Users###\Desktop\notion\config.py", line 2, in from notion_client import Client ModuleNotFoundError: No module named 'notion_client'

    opened by serjanbiogenic 1
Owner
Steve Sun
Java/Python/JS
Steve Sun
Generate knowledge graphs with interesting geometries, like lattices

Geometric Graphs Generate knowledge graphs with interesting geometries, like lattices. Works on Python 3.9+ because it uses cool new features. Get out

Charles Tapley Hoyt 5 Jan 3, 2022
View part of your screen in grayscale or simulated color vision deficiency.

monolens View part of your screen in grayscale or filtered to simulate color vision deficiency. Watch the demo on YouTube. Install with pip install mo

Hans Dembinski 31 Oct 11, 2022
view cool stats related to your discord account.

DiscoStats cool statistics generated using your discord data. How? DiscoStats is not a service that breaks the Discord Terms of Service or Community G

ibrahim hisham 5 Jun 2, 2022
In-memory Graph Database and Knowledge Graph with Natural Language Interface, compatible with Pandas

CogniPy for Pandas - In-memory Graph Database and Knowledge Graph with Natural Language Interface Whats in the box Reasoning, exploration of RDF/OWL,

Cognitum Octopus 34 Dec 13, 2022
ICS-Visualizer is an interactive Industrial Control Systems (ICS) network graph that contains up-to-date ICS metadata

ICS-Visualizer is an interactive Industrial Control Systems (ICS) network graph that contains up-to-date ICS metadata (Name, company, port, user manua

QeeqBox 2 Dec 13, 2021
A little logger for machine learning research

dowel dowel is a little logger for machine learning research. Installation pip install dowel Usage import dowel from dowel import logger, tabular log

Reinforcement Learning Working Group 27 Dec 3, 2022
Blender addon that creates a temporary window of any type from the 3D View.

CreateTempWindow2.8 Blender addon that creates a temporary window of any type from the 3D View. Features Can the following window types: 3D View Graph

null 3 Nov 27, 2022
A command line tool for visualizing CSV/spreadsheet-like data

PerfPlotter Read data from CSV files using pandas and generate interactive plots using bokeh, which can then be embedded into HTML pages and served by

Gino Mempin 0 Jun 25, 2022
Tools for calculating and visualizing Elo-like ratings of MLB teams using Retosheet data

Overview This project uses historical baseball games data to calculate an Elo-like rating for MLB teams based on regular season match ups. The Elo rat

Lukas Owens 0 Aug 25, 2021
This project is an Algorithm Visualizer where a user can visualize algorithms like Bubble Sort, Merge Sort, Quick Sort, Selection Sort, Linear Search and Binary Search.

Algo_Visualizer This project is an Algorithm Visualizer where a user can visualize common algorithms like "Bubble Sort", "Merge Sort", "Quick Sort", "

Rahul 4 Feb 7, 2022
Python script to generate a visualization of various sorting algorithms, image or video.

sorting_algo_visualizer Python script to generate a visualization of various sorting algorithms, image or video.

null 146 Nov 12, 2022
Generate graphs with NetworkX, natively visualize with D3.js and pywebview

webview_d3 This is some PoC code to render graphs created with NetworkX natively using D3.js and pywebview. The main benifit of this approac

byt3bl33d3r 68 Aug 18, 2022
Generate a 3D Skyline in STL format and a OpenSCAD file from Gitlab contributions

Your Gitlab's contributions in a 3D Skyline gitlab-skyline is a Python command to generate a skyline figure from Gitlab contributions as Github did at

Félix Gómez 70 Dec 22, 2022
BGraph is a tool designed to generate dependencies graphs from Android.bp soong files.

BGraph BGraph is a tool designed to generate dependencies graphs from Android.bp soong files. Overview BGraph (for Build-Graphs) is a project aimed at

Quarkslab 10 Dec 19, 2022
script to generate HeN ipfs app exports of GLSL shaders

HeNerator A simple script to generate HeN ipfs app exports from any frag shader created with: GlslViewer GlslEditor The Book of Shaders glslCanvas VS

Patricio Gonzalez Vivo 22 Dec 21, 2022
A script written in Python that generate output custom color (HEX or RGB input to x1b hexadecimal)

ColorShell ─ 1.5 Planned for v2: setup.sh for setup alias This script converts HEX and RGB code to x1b x1b is code for colorize outputs, works on ou

Riley 4 Oct 31, 2021
Wikipedia WordCloud App generate Wikipedia word cloud art created using python's streamlit, matplotlib, wikipedia and wordcloud packages

Wikipedia WordCloud App Wikipedia WordCloud App generate Wikipedia word cloud art created using python's streamlit, matplotlib, wikipedia and wordclou

Siva Prakash 5 Jan 2, 2022
Generate the report for OCULTest.

Sample report generated in this function Usage example from utils.gen_report import generate_report if __name__ == '__main__': # def generate_rep

Philip Guo 1 Mar 10, 2022
Because trello only have payed options to generate a RunUp chart, this solves that!

Trello Runup Chart Generator The basic concept of the project is that Corello is pay-to-use and want to use Trello To-Do/Doing/Done automation with gi

Rômulo Schiavon 1 Dec 21, 2021