K00B404 commited on
Commit
d03b4aa
·
verified ·
1 Parent(s): 8930209

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -30,6 +30,23 @@ def check_db_writable(file_path):
30
 
31
  check_db_writable(db_file_path)
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  # Initialize the database
34
  def init_db(file='logs.db'):
35
  conn = sqlite3.connect(file)
 
30
 
31
  check_db_writable(db_file_path)
32
 
33
+ def fetch_logs(file_path):
34
+ try:
35
+ conn = sqlite3.connect(file_path)
36
+ cursor = conn.cursor()
37
+
38
+ cursor.execute("SELECT * FROM requests;") # Adjust this query based on your table schema
39
+ logs = cursor.fetchall()
40
+
41
+ for log in logs:
42
+ print(log)
43
+
44
+ conn.close()
45
+ except Exception as e:
46
+ print(f"Error fetching logs: {e}")
47
+
48
+ fetch_logs(db_file_path)
49
+
50
  # Initialize the database
51
  def init_db(file='logs.db'):
52
  conn = sqlite3.connect(file)