Finalize the finance cache puller

This commit is contained in:
2026-02-11 20:14:56 -08:00
parent 777483f8bf
commit b81f26daa8
2 changed files with 35 additions and 33 deletions
+27
View File
@@ -0,0 +1,27 @@
import sqlite3
class DataBase:
def __init__(self):
# Initilize SqLite
self.conn = sqlite3.connect("./data/appdata.db")
self.cursor = self.conn.cursor()
# Create keystore table if it doesnt exist already
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS keystore (
key TEXT PRIMARY KEY,
value TEXT
)
''')
# Set a key in the keystore
def SetKey(self, Key, Value):
self.cursor.execute('INSERT OR REPLACE INTO keystore (key, value) VALUES (?, ?)', (Key, Value))
self.conn.commit()
# Get a key from the keystore
def GetKey(self, Key):
self.cursor.execute('SELECT value FROM keystore WHERE key = ?', (Key, ))
result = self.cursor.fetchone()
return result[0] if result else None