libJournal v1.1.0¶
This version of libJournal is very different from v1.0. There are a couple syntax chagnes, yet most changes take place in the source code. To install this version of libJournal use this:
pip install libjournal==1.1.0
Once installed, one must setup before using libJournal:
# Import libJournal
from libjournal.libj import libJournal
# Initialize the libJournal object & set the location of the JSON
libj = libJournal()
libj.set_json_location("example.json")
The entry_add() method is used to add entries and the entry_delete() method is used to delete entries:
# Adds an entry with the name "title", and with the content "Cats"
libj.add_entry("Title", "Cats")
# Deletes an entry with the name "title", and with the content "Cats"
libj.delete_entry("Title")
Please note that entry titles cannot be the same! Next in use the find_entry() method in order to search for an entry based on title and return true or false:
# Searches for the entry with the title "Title" and returns a boolean
libj.find_entry("Title")
Finally, you can use the read_entry() in order to read a certain entry:
# Opens the entry with the title "Title" and returns the content of that entry
libj.read_entry("Title")
That’s all for this version of libJournal!