I am trying to insert geometry points into PostGIS database. Well I tried to use a function just to read points coordinates and attributes and save them in a table in PostGIS. It works for attributes but not for geometry. This is my code and I will be appreciated to any help!

    insert(id, Height, X, Y)
    ....
    def insert(gid,height, X, Y):
       gid=str(gid)
       connection = psycopg2.connect(host='', dbname='postgres',   user='', password='')     
        cur = connection.cursor()
       cur.execute ("""INSERT INTO gronkarta.test5 (gid, height, geom) VALUES (""" + gid + """,""" + str(height) + ""","""+ST_GeomFromText('POINT(X Y)', 3008)+""");""")