DmitrMakeev
commited on
Commit
•
1ce6a36
1
Parent(s):
e60d301
Update google_db.py
Browse files- google_db.py +14 -12
google_db.py
CHANGED
@@ -5,6 +5,14 @@ import requests
|
|
5 |
api_variabl = os.getenv('api_key')
|
6 |
google_url = os.getenv('goo_url')
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def save_db():
|
9 |
err = 0
|
10 |
|
@@ -26,17 +34,11 @@ def save_db():
|
|
26 |
ec_B_eep_db = globs.ec_B_eep
|
27 |
ec_C_eep_db = globs.ec_C_eep
|
28 |
|
29 |
-
# Формируем
|
30 |
-
|
31 |
-
'action': "addData",
|
32 |
-
'dey': dey_db,
|
33 |
-
'wek': wek_db,
|
34 |
-
'v_hid': v_hid_db,
|
35 |
-
|
36 |
-
}
|
37 |
|
38 |
-
# Отправляем
|
39 |
-
response = requests.
|
40 |
|
41 |
# Проверяем статус ответа
|
42 |
if response.status_code == 200:
|
@@ -47,8 +49,8 @@ def save_db():
|
|
47 |
err = 0
|
48 |
|
49 |
# Создаем JSON-объект для возвращения
|
50 |
-
response_data = {
|
51 |
-
"eep_set": globs.eep_set,
|
52 |
"err": err
|
53 |
}
|
54 |
|
|
|
5 |
api_variabl = os.getenv('api_key')
|
6 |
google_url = os.getenv('goo_url')
|
7 |
|
8 |
+
from flask import jsonify
|
9 |
+
import requests
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
def save_db():
|
17 |
err = 0
|
18 |
|
|
|
34 |
ec_B_eep_db = globs.ec_B_eep
|
35 |
ec_C_eep_db = globs.ec_C_eep
|
36 |
|
37 |
+
# Формируем URL с параметрами
|
38 |
+
url_with_params = f"{google_url}?dey={dey_db}&wek={wek_db}&v_hid={v_hid_db}&v_min={v_min_db}&ph={ph_db}&ec={ec_db}&tS={tS_db}&tA={tA_db}&hDm={hDm_db}&sVen={sVen_db}&ec_A_eep={ec_A_eep_db}&ec_B_eep={ec_B_eep_db}&ec_C_eep={ec_C_eep_db}"
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
# Отправляем GET запрос
|
41 |
+
response = requests.get(url_with_params)
|
42 |
|
43 |
# Проверяем статус ответа
|
44 |
if response.status_code == 200:
|
|
|
49 |
err = 0
|
50 |
|
51 |
# Создаем JSON-объект для возвращения
|
52 |
+
response_data = {
|
53 |
+
"eep_set": globs.eep_set,
|
54 |
"err": err
|
55 |
}
|
56 |
|