def storePassword(username, password, key, cor_site):
     """
     store username, and password(DES) use key and store into db
     """
     # encrypt key
     des = DES()
     des.setKey(key)
     password = des.encrypt(password)
     with _mysql.connect(Constant.HOST, Constant.USER, Constant.PASSWORD,
                         Constant.DB) as db:
         db.query(
             "INSERT INTO passtable (corsite, username, password) VALUES (%s, %s, %s)"
             % (cor_site, username, password))
     print("Successful insert new record!")
 def retrievePassword(cor_site, key):
     """
     retrieve password from db according to username, and decrypt it with key
     """
     des = DES()
     des.setKey(key)
     with _mysql.connect(Constant.HOST, Constant.USER, Constant.PASSWORD,
                         Constant.DB) as db:
         cur = db.cursor()
         cur.query("SELECT * FROM passtable WHERE corsite = %s" % cor_site)
         for match in cur.fetchall():
             print("Username: "******"Password: "******"#################################################################"
             )