A helper script for easy handling of JSON file as database in local storage.
pip install localdb.json
from localdb import Database
db = Database("example.json")This creates a key with the given value. It will overwrite existing key's value. Always returns True.
db.set("TEST", "VALUE")
>>> TrueReturns value of requested key if it exists or will return None.
db.get("TEST")
>>> VALUERenames an existing key to another. Returns True if it exists or will return None.
db.rename("TEST", "Test")
>>> TrueDeletes key and value from database. Returns True if it exists or will return None.
db.delete("Test")
>>> TrueSize of database file is returned in bytes.
db.size
>>> 42Open issues or ask here
Pull requests are welcome.
Licensed under GNU Affero General Public License v3.