Python library to access and manipulate graphs

Hi there,

I’ve conducted some research myself on this topic by using an extensible Markdown parser called Marko. I’ve been successful in extending it to understand several types of Logseq specific tags, like labels and the LOGBOOK section. However, I’m far from using all the potential Logseq provides and for sure I’m going to discover features I’m not currently using to have an interesting case use.

Therefore, I was wondering if there is any library or module in Python to parse Logseq graphs well, taking into account as many Logseq features as possible, and with far more accuracy and less errors than my experiments. I would like very much to create Python scripts to take out data from Logseq to other secondary systems, like databases.

Is there such thing available?

Thank you so much for your responses.

Hi, do you know that Logseq has a built-in HTTP server with the same API available for plugins?

You just need Logseq running, the server enabled and you will be able to use HTTP+JSON from Python to perform queries, update blocks and everything plugins can do. :slightly_smiling_face:

Alternatively, if you don’t want Logseq running, you may found useful this script that given a graph folder outputs the Logseq AST:

An ast tree is basically a data representation of a file that identifies almost every actionable piece of text Logseq recognizes e.g. a url, property, page reference, etc.

1 Like