Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import flask
|
2 |
from flask import request, jsonify, send_file
|
3 |
import os
|
4 |
-
|
5 |
import asyncio
|
6 |
import aiohttp
|
7 |
|
@@ -14,15 +14,56 @@ from api_logic import api
|
|
14 |
|
15 |
|
16 |
|
17 |
-
from google_db import save_db
|
18 |
|
19 |
-
from my_sqlite import create_SQL
|
20 |
|
21 |
load_dotenv()
|
22 |
|
23 |
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
|
28 |
|
|
|
1 |
import flask
|
2 |
from flask import request, jsonify, send_file
|
3 |
import os
|
4 |
+
import sqlite3
|
5 |
import asyncio
|
6 |
import aiohttp
|
7 |
|
|
|
14 |
|
15 |
|
16 |
|
|
|
17 |
|
|
|
18 |
|
19 |
load_dotenv()
|
20 |
|
21 |
|
22 |
|
23 |
+
def init_db(db_name):
|
24 |
+
conn = sqlite3.connect(db_name)
|
25 |
+
cursor = conn.cursor()
|
26 |
+
|
27 |
+
# Создаем таблицу
|
28 |
+
cursor.execute('''
|
29 |
+
CREATE TABLE IF NOT EXISTS system_data (
|
30 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT, -- Автоинкрементный счётчик
|
31 |
+
date_time TEXT, -- Дата и время
|
32 |
+
dey TEXT,
|
33 |
+
wek TEXT,
|
34 |
+
v_hid TEXT,
|
35 |
+
v_min TEXT,
|
36 |
+
ph TEXT,
|
37 |
+
ec TEXT,
|
38 |
+
tS TEXT,
|
39 |
+
tA TEXT,
|
40 |
+
hDm TEXT,
|
41 |
+
sVen TEXT,
|
42 |
+
rFul TEXT,
|
43 |
+
rLi TEXT,
|
44 |
+
rWat TEXT,
|
45 |
+
rRas TEXT,
|
46 |
+
rPH TEXT,
|
47 |
+
rEC TEXT,
|
48 |
+
rSl TEXT,
|
49 |
+
rLe TEXT,
|
50 |
+
alW TEXT,
|
51 |
+
ph_eep TEXT,
|
52 |
+
ph_on_eep TEXT,
|
53 |
+
ec_eep TEXT,
|
54 |
+
ec_A_eep TEXT,
|
55 |
+
ec_B_eep TEXT,
|
56 |
+
ec_C_eep TEXT,
|
57 |
+
l_ON_h_eep TEXT,
|
58 |
+
l_ON_m_eep TEXT,
|
59 |
+
l_OFF_h_eep TEXT,
|
60 |
+
l_OFF_m_eep TEXT,
|
61 |
+
t_Voz_eep TEXT
|
62 |
+
)
|
63 |
+
''')
|
64 |
+
|
65 |
+
conn.commit()
|
66 |
+
conn.close()
|
67 |
|
68 |
|
69 |
|