File size: 3,202 Bytes
89fe525
4da42d7
f93443c
c40c0f0
a312100
06e3580
3cc91b4
d5265cc
4c9bda7
 
 
 
 
 
 
 
 
 
 
 
3cc91b4
0fdaa87
89fe525
4549c9e
 
 
 
 
9e200e9
e54b720
666378e
 
 
e11deda
 
899f43f
 
ef5c00c
b5ef022
 
 
 
 
 
 
 
 
da530b5
b5ef022
b9feb9c
f4638c4
4d801ef
 
56f5932
0d12015
56f5932
4d801ef
bdd2d6e
 
 
 
 
b5ef022
4549c9e
 
 
 
f34c200
4549c9e
 
89fe525
4549c9e
89fe525
faedad5
5ff16d2
3777f42
711c245
5b7131d
e821bec
 
df74a7a
 
7275909
 
a882654
0a0aaa7
89fe525
4549c9e
89fe525
4549c9e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from flask import request, jsonify
import globs
import os
api_variable = os.getenv('api_key_s')




globs.ph_set = 0
globs.ph_on_set = 0
globs.ec_set = 0
globs.ec_A_set = 0
globs.ec_B_set = 0
globs.ec_C_set = 0
globs.l_ON_h_set = 0
globs.l_ON_m_set = 0
globs.l_OFF_h_set = 0
globs.l_OFF_m_set = 0
globs.ec_t_Voz_set = 0        
globs.eep_set = 0


def api():
    err = 0

    # Проверяем условие и выполняем кусок кода, если условие истинно
    if api_variable == request.args.get('api'):
        # Вставьте сюда ваш кусок кода, который должен выполняться, если условие истинно
        # Читаем значение параметра и заносим в глобальную переменную
        globs.dey = request.args.get('dey')
        globs.wek = request.args.get('wek')
        globs.v_hid = request.args.get('v_hid')
        globs.v_min = request.args.get('v_min') 
        globs.ph = request.args.get('ph')
        globs.ec = request.args.get('ec')
        globs.tS = request.args.get('tS')
        globs.tA = request.args.get('tA')
        globs.hDm = request.args.get('hDm')
        globs.sVen = request.args.get('sVen')
        
        globs.rFul = request.args.get('rFul')
        globs.rLi = request.args.get('rLi') 
        globs.rWat = request.args.get('rWat') 
        globs.rRas = request.args.get('rRas') 
        globs.rPH = request.args.get('rPH') 
        globs.rEC = request.args.get('rEC') 
        globs.rSl = request.args.get('rSl') 
        globs.rLe = request.args.get('rLe') 
        globs.alW = request.args.get('alW') 

        globs.ph_eep = request.args.get('ph_eep') 
        globs.ph_on_eep = request.args.get('ph_on_eep')
        globs.ec_eep = request.args.get('ec_eep') 
        globs.ec_A_eep = request.args.get('ec_A_eep') 
        globs.ec_B_eep = request.args.get('ec_B_eep')
        globs.ec_C_eep = request.args.get('ec_C_eep')

        globs.l_ON_h_eep = request.args.get('l_ON_h_eep')      
        globs.l_ON_m_eep = request.args.get('l_ON_m_eep') 
        globs.l_OFF_h_eep = request.args.get('l_OFF_h_eep')        
        globs.l_OFF_m_eep = request.args.get('l_OFF_m_eep') 
        globs.t_Voz_eep = request.args.get('t_Voz_eep')        
        
        err = 1
        pass
    else:
        # Вставьте сюда ваш кусок кода, который должен выполняться, если условие ложно
 
        err = 0
        pass
    
    # Создаем JSON-объект
    response = {
        "1_ph_set": globs.ph_set,
        "2_ph_on_set": globs.ph_on_set,
        "3_ec_set": globs.ec_set,
        "4_ec_A_set": globs.ec_A_set,
        "5_ec_B_set": globs.ec_B_set,
        "6_ec_C_set": globs.ec_C_set,
        "7_l_ON_h_set": globs.l_ON_h_set,
        "7_l_ON_m_set": globs.l_ON_m_set,
        "8_l_OFF_h_set": globs.l_OFF_h_set,
        "8_l_OFF_m_set": globs.l_OFF_m_set,
        "9_ec_t_Voz_set": globs.ec_t_Voz_set,        
        "eep_set": globs.eep_set,        
        "err": err
    }

    # Возвращаем JSON-объект
    return jsonify(response)