class Database(object):
def __init__(self,ip_address,datetime_now):
self.db_connec = mysql.connector.connect(user = DATABASE_USER, password = DATABASE_PASS, host = DATABASE_HOST, database = DATABASE)
self.ip = ip_address
self.datetime_now = datetime_now
def run_query(self, query):
if db_connec == None:
raise mysql.connector.DatabaseError
return None
def log_threat(self):
lol = "ass"
self.cursor = self.db_connec.cursor()
self.cursor.execute("INSERT INTO unauthorized_clients (ip_address, time) VALUES ({}, {})".format(self.ip, lol))
#INSERT INTO unauthorized_clients (ip_address, time) VALUES ("trtr", "test")
I'm calling the log_threat function and getting this error. When i run the query non-blind in a mysql terminal (navicat) it works fine but here i get this error .
check the manual corresponds to your MySQL server version for the right syntax to use near '0.1, ass)' at line 1
why is the ip being stripped?
when i log print(self.ip), i get 127.0.0.1