DmitrMakeev commited on
Commit
38951b0
1 Parent(s): d75f003

Create save_sql.py

Browse files
Files changed (1) hide show
  1. save_sql.py +76 -0
save_sql.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import request, jsonify
2
+ import globs
3
+ import os
4
+ api_variabl = os.getenv('api_key_s')
5
+
6
+
7
+ def sql_save():
8
+ err = 0
9
+
10
+ # Проверяем условие и выполняем кусок кода, если условие истинно
11
+ if api_variabl == request.args.get('api'):
12
+ # Вставьте сюда ваш кусок кода, который должен выполняться, если условие истинно
13
+ # Читаем значение параметра и заносим в глобальную переменную
14
+ globs.dey = request.args.get('dey')
15
+ globs.wek = request.args.get('wek')
16
+ globs.v_hid = request.args.get('v_hid')
17
+ globs.v_min = request.args.get('v_min')
18
+ globs.ph = request.args.get('ph')
19
+ globs.ec = request.args.get('ec')
20
+ globs.tS = request.args.get('tS')
21
+ globs.tA = request.args.get('tA')
22
+ globs.hDm = request.args.get('hDm')
23
+ globs.sVen = request.args.get('sVen')
24
+
25
+ globs.rFul = request.args.get('rFul')
26
+ globs.rLi = request.args.get('rLi')
27
+ globs.rWat = request.args.get('rWat')
28
+ globs.rRas = request.args.get('rRas')
29
+ globs.rPH = request.args.get('rPH')
30
+ globs.rEC = request.args.get('rEC')
31
+ globs.rSl = request.args.get('rSl')
32
+ globs.rLe = request.args.get('rLe')
33
+ globs.alW = request.args.get('alW')
34
+
35
+ globs.ph_eep = request.args.get('ph_eep')
36
+ globs.ph_on_eep = request.args.get('ph_on_eep')
37
+ globs.ec_eep = request.args.get('ec_eep')
38
+ globs.ec_A_eep = request.args.get('ec_A_eep')
39
+ globs.ec_B_eep = request.args.get('ec_B_eep')
40
+ globs.ec_C_eep = request.args.get('ec_C_eep')
41
+
42
+ globs.l_ON_h_eep = request.args.get('l_ON_h_eep')
43
+ globs.l_ON_m_eep = request.args.get('l_ON_m_eep')
44
+ globs.l_OFF_h_eep = request.args.get('l_OFF_h_eep')
45
+ globs.l_OFF_m_eep = request.args.get('l_OFF_m_eep')
46
+ globs.t_Voz_eep = request.args.get('t_Voz_eep')
47
+
48
+ err = 1
49
+ pass
50
+ else:
51
+ # Вставьте сюда ваш кусок кода, который должен выполняться, если условие ложно
52
+
53
+ err = 0
54
+ pass
55
+
56
+ # Создаем JSON-объект
57
+ response = {
58
+ "1_ph_set": globs.ph_set,
59
+ "2_ph_on_set": globs.ph_on_set,
60
+ "3_ec_set": globs.ec_set,
61
+ "4_ec_A_set": globs.ec_A_set,
62
+ "5_ec_B_set": globs.ec_B_set,
63
+ "6_ec_C_set": globs.ec_C_set,
64
+ "7_l_ON_h_set": globs.l_ON_h_set,
65
+ "7_l_ON_m_set": globs.l_ON_m_set,
66
+ "8_l_OFF_h_set": globs.l_OFF_h_set,
67
+ "8_l_OFF_m_set": globs.l_OFF_m_set,
68
+ "9_ec_t_Voz_set": globs.ec_t_Voz_set,
69
+ "eep_set": globs.eep_set,
70
+ "err": err
71
+ }
72
+
73
+ # Возвращаем JSON-объект
74
+ return jsonify(response)
75
+
76
+