zmiana ip

This commit is contained in:
Mateusz779 2023-04-19 10:22:38 +02:00
parent e2285cee08
commit 6fe743c281

13
db.py
View File

@ -247,9 +247,7 @@ def del_image_allocation(sql, value):
def del_image_allocation_id_image(image_id): def del_image_allocation_id_image(image_id):
delete = del_image_allocation("DELETE FROM image_allocation WHERE image_id = %s", image_id) return del_image_allocation("DELETE FROM image_allocation WHERE image_id = %s", image_id)
print(delete)
return delete
def del_image_allocation_id(id): def del_image_allocation_id(id):
@ -268,12 +266,15 @@ def update_image_allocation_time(id):
except: except:
return None return None
def update_image_allocation_ip(id, ip): def update_image_allocation_ip(token, ip):
image_id = get_conf_id(token)
if image_id is None:
return None
connect() connect()
with get_cur() as cur: with get_cur() as cur:
cur.execute(""" cur.execute("""
UPDATE image_allocation SET ip = %s WHERE id = %s UPDATE image_allocation SET ip = %s WHERE image_id = %s
""", (ip, id,)) """, (ip, image_id,))
try: try:
conn.commit() conn.commit()
return True return True