Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
0827625
1
Parent(s):
d76138f
Update my_sqlite.py
Browse files- my_sqlite.py +84 -0
my_sqlite.py
CHANGED
@@ -1,6 +1,12 @@
|
|
1 |
import sqlite3
|
2 |
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
def create_database_and_table():
|
6 |
# Создание подключения к базе данных SQLite
|
@@ -37,3 +43,81 @@ def create_database_and_table():
|
|
37 |
|
38 |
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import sqlite3
|
2 |
|
3 |
|
4 |
+
from flask import request, jsonify
|
5 |
+
import globs
|
6 |
+
import os
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
|
11 |
def create_database_and_table():
|
12 |
# Создание подключения к базе данных SQLite
|
|
|
43 |
|
44 |
|
45 |
|
46 |
+
api_variabl = os.getenv('api_key_s')
|
47 |
+
|
48 |
+
|
49 |
+
def sql_save():
|
50 |
+
err = 0
|
51 |
+
|
52 |
+
# Проверяем условие и выполняем кусок кода, если условие истинно
|
53 |
+
if api_variabl == request.args.get('api'):
|
54 |
+
# Вставьте сюда ваш кусок кода, который должен выполняться, если условие истинно
|
55 |
+
# Читаем значение параметра и заносим в глобальную переменную
|
56 |
+
globs.dey = request.args.get('dey')
|
57 |
+
globs.wek = request.args.get('wek')
|
58 |
+
globs.v_hid = request.args.get('v_hid')
|
59 |
+
globs.v_min = request.args.get('v_min')
|
60 |
+
globs.ph = request.args.get('ph')
|
61 |
+
globs.ec = request.args.get('ec')
|
62 |
+
globs.tS = request.args.get('tS')
|
63 |
+
globs.tA = request.args.get('tA')
|
64 |
+
globs.hDm = request.args.get('hDm')
|
65 |
+
globs.sVen = request.args.get('sVen')
|
66 |
+
|
67 |
+
globs.rFul = request.args.get('rFul')
|
68 |
+
globs.rLi = request.args.get('rLi')
|
69 |
+
globs.rWat = request.args.get('rWat')
|
70 |
+
globs.rRas = request.args.get('rRas')
|
71 |
+
globs.rPH = request.args.get('rPH')
|
72 |
+
globs.rEC = request.args.get('rEC')
|
73 |
+
globs.rSl = request.args.get('rSl')
|
74 |
+
globs.rLe = request.args.get('rLe')
|
75 |
+
globs.alW = request.args.get('alW')
|
76 |
+
|
77 |
+
globs.ph_eep = request.args.get('ph_eep')
|
78 |
+
globs.ph_on_eep = request.args.get('ph_on_eep')
|
79 |
+
globs.ec_eep = request.args.get('ec_eep')
|
80 |
+
globs.ec_A_eep = request.args.get('ec_A_eep')
|
81 |
+
globs.ec_B_eep = request.args.get('ec_B_eep')
|
82 |
+
globs.ec_C_eep = request.args.get('ec_C_eep')
|
83 |
+
|
84 |
+
globs.l_ON_h_eep = request.args.get('l_ON_h_eep')
|
85 |
+
globs.l_ON_m_eep = request.args.get('l_ON_m_eep')
|
86 |
+
globs.l_OFF_h_eep = request.args.get('l_OFF_h_eep')
|
87 |
+
globs.l_OFF_m_eep = request.args.get('l_OFF_m_eep')
|
88 |
+
globs.t_Voz_eep = request.args.get('t_Voz_eep')
|
89 |
+
|
90 |
+
err = 1
|
91 |
+
pass
|
92 |
+
else:
|
93 |
+
# Вставьте сюда ваш кусок кода, который должен выполняться, если условие ложно
|
94 |
+
|
95 |
+
err = 0
|
96 |
+
pass
|
97 |
+
|
98 |
+
# Создаем JSON-объект
|
99 |
+
response = {
|
100 |
+
"1_ph_set": globs.ph_set,
|
101 |
+
"2_ph_on_set": globs.ph_on_set,
|
102 |
+
"3_ec_set": globs.ec_set,
|
103 |
+
"4_ec_A_set": globs.ec_A_set,
|
104 |
+
"5_ec_B_set": globs.ec_B_set,
|
105 |
+
"6_ec_C_set": globs.ec_C_set,
|
106 |
+
"7_l_ON_h_set": globs.l_ON_h_set,
|
107 |
+
"7_l_ON_m_set": globs.l_ON_m_set,
|
108 |
+
"8_l_OFF_h_set": globs.l_OFF_h_set,
|
109 |
+
"8_l_OFF_m_set": globs.l_OFF_m_set,
|
110 |
+
"9_ec_t_Voz_set": globs.ec_t_Voz_set,
|
111 |
+
"eep_set": globs.eep_set,
|
112 |
+
"err": err
|
113 |
+
}
|
114 |
+
|
115 |
+
# Возвращаем JSON-объект
|
116 |
+
return jsonify(response)
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
|