def test_db(): """test the db operation.""" myconfig=DBConfig() myconfig.connect_db() values=['www.aaa.com','555','www.bbb.com'] myconfig.insert_db(values) print myconfig.select_db() myconfig.deldata_db() myconfig.close_db()
def xml_to_db(): """insert into database from xml file""" myconfig=DBConfig() phish_list=test_xmlread() myconfig.connect_db() try: for phish in phish_list: myconfig.insert_db(phish) myconfig.count+=1 myconfig.close_db() print "The phish list have already inserted into database" except Exception as e: print e