IsaacKerson commited on
Commit
a8352e3
1 Parent(s): 8df7237

add get_connection and check_connection to auth

Browse files
Files changed (2) hide show
  1. authenticator.py +11 -0
  2. pages/login.py +2 -1
authenticator.py CHANGED
@@ -89,6 +89,17 @@ class Authenticate:
89
  dir = os.path.dirname(os.path.abspath(__file__))
90
  return os.path.join(dir, self.dbname)
91
 
 
 
 
 
 
 
 
 
 
 
 
92
  def token_encode(self):
93
  """
94
  Returns
 
89
  dir = os.path.dirname(os.path.abspath(__file__))
90
  return os.path.join(dir, self.dbname)
91
 
92
+ def get_connection(self):
93
+ return sqlite3.connect(self.get_path)
94
+
95
+ def check_connection(self):
96
+ try:
97
+ self.get_connection.cursor()
98
+ return True
99
+ except Exception as ex:
100
+ return False
101
+
102
+ return c, conn
103
  def token_encode(self):
104
  """
105
  Returns
pages/login.py CHANGED
@@ -21,7 +21,6 @@ def app():
21
  with open(yamel_path) as file:
22
  config = yaml.safe_load(file)
23
 
24
-
25
  auth = Authenticate(
26
  config['database']['name'],
27
  config['database']['table'],
@@ -31,6 +30,8 @@ def app():
31
  )
32
 
33
  st.write(auth.get_path())
 
 
34
  # auth.login('Login', 'main')
35
 
36
  # if st.session_state['authentication_status']:
 
21
  with open(yamel_path) as file:
22
  config = yaml.safe_load(file)
23
 
 
24
  auth = Authenticate(
25
  config['database']['name'],
26
  config['database']['table'],
 
30
  )
31
 
32
  st.write(auth.get_path())
33
+ st.write(auth.get_connection())
34
+ st.write(auth.check_connection())
35
  # auth.login('Login', 'main')
36
 
37
  # if st.session_state['authentication_status']: