def __init__(self, username: str, password: str, database: str, table: str): self.uname = username self.passw = password self.table = table self.db = database # create a `Database` class instance self.const = auth.Database(self.uname, self.passw) self.connection = mc.connect(host="localhost", user=f"{self.uname}", password=f"{self.passw}", database=f"{self.db}", autocommit=True) self.cursor = self.connection.cursor(buffered=True)
def __init__(self, username: str, password: str): self.uname = username self.passw = password # create a `Database` class instance self.const = auth.Database(self.uname, self.passw) # authenticate data using auth module authenticate = self.const.authenticate() if (authenticate is True): # initialize connection with MySQL server and cursor object for execution of commands self.connection = mc.connect(host="localhost", user=f"{self.uname}", password=f"{self.passw}", autocommit=True) self.cursor = self.connection.cursor(buffered=True) else: raise Exception("User could not be authenticated")
import data.imports as imports import data.update as update except: raise Exception("Package Error: modules not setup") __version__ = "1.0.8" print(info.ascii_art) time.sleep(1) uname = input("Username: "******"Password: "******"\n[-] User could not be authenticated") exit() print(f"\n[+] User authenticated") time.sleep(1) print(info.menu) # package class instances as objects for calling functions ddl_obj = ddl.DDL(uname, passwd) dml_obj = dml.DML(uname, passwd) exp_obj = export.Export(uname, passwd) imp_obj = imports.Import(uname, passwd)