DmitrMakeev
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1169,10 +1169,15 @@ def insert_data(data):
|
|
1169 |
msk_now = utc_now.replace(tzinfo=pytz.utc).astimezone(msk_tz)
|
1170 |
data_t = msk_now.strftime('%Y-%m-%d %H:%M:%S')
|
1171 |
|
|
|
|
|
|
|
|
|
|
|
1172 |
cursor.execute('''
|
1173 |
INSERT INTO contacts (name, phone, email, data_t)
|
1174 |
VALUES (?, ?, ?, ?)
|
1175 |
-
''', (
|
1176 |
conn.commit()
|
1177 |
conn.close()
|
1178 |
|
|
|
1169 |
msk_now = utc_now.replace(tzinfo=pytz.utc).astimezone(msk_tz)
|
1170 |
data_t = msk_now.strftime('%Y-%m-%d %H:%M:%S')
|
1171 |
|
1172 |
+
# Проверка наличия ключей перед их использованием
|
1173 |
+
name = row.get('name', '')
|
1174 |
+
phone = row.get('phone', '')
|
1175 |
+
email = row.get('email', '')
|
1176 |
+
|
1177 |
cursor.execute('''
|
1178 |
INSERT INTO contacts (name, phone, email, data_t)
|
1179 |
VALUES (?, ?, ?, ?)
|
1180 |
+
''', (name, phone, email, data_t))
|
1181 |
conn.commit()
|
1182 |
conn.close()
|
1183 |
|