1) It's really helpful if you're asking a question to do with a DB or single table within a DB, that you provide a schema - else really, it's a bit of a guess (you could & should use 'Improve Question' to update your question)
2) The thing I see straight off is this statement
cursor.execute("""INSERT INTO TempDB VALUES('',%s, %s)""", (temperature,humidity))
has three values, yet I suspect your table has an autoincrement ID column as the first column, then fields for the temperature & humidity - so you don't need the empty field at the start of the values (but see point 1 why this may be a guess)
3) although it seems 'easy' to write SQL that way, it's not in the long run - it's a security risk for a start ... you really need to write a paramaterized statement ...
with con:
cursor = con.cursor(prepared=True)
sql_insert_query = """ INSERT INTO TempDB (temperature, humidity) VALUES (?,?)"""
insert_tuple = (temperature, humidity)
cursor.execute(sql_insert_query, insert_tuple)
con.commit()
As stated, Ive had to assume your column names - see how I state the column names in the insert query, that means anyone reading your code later knows rather than guesses where things are going - sometime being explicit is better - easy enough to change the names. These links below may help as well in future
Best practice for SQL statements in Python - b.telligent[
^] (See Under 'Best practice: parameterised queries')
https://pynative.com/python-mysql-execute-parameterized-query-using-prepared-statement/[
^]