Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
9cdb15f
1
Parent(s):
4eee61b
Update google_db.py
Browse files- google_db.py +8 -20
google_db.py
CHANGED
@@ -3,23 +3,11 @@ import os
|
|
3 |
import requests
|
4 |
import globs
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
api_key = os.getenv('api_key')
|
11 |
base_url = os.getenv('base_url') # URL сервера, например, 'https://api.notisend.ru/v1/email/'
|
12 |
token = os.getenv('token') # Ваш токен
|
13 |
|
14 |
-
|
15 |
-
globs.name = "Дмит"
|
16 |
-
globs.email = "mico@ght.com"
|
17 |
-
globs.phone = "0"
|
18 |
-
globs.grup_id = "test"
|
19 |
-
globs.pr1 = "0"
|
20 |
-
globs.pr2 = "0"
|
21 |
-
|
22 |
-
def save_db():
|
23 |
err = 0
|
24 |
|
25 |
if api_key == request.args.get('api'):
|
@@ -28,18 +16,18 @@ def save_db():
|
|
28 |
emails = globs.email
|
29 |
phones = globs.phone
|
30 |
grups_id = globs.grup_id # Это List ID
|
31 |
-
|
32 |
-
|
33 |
|
34 |
# Создаем данные для отправки
|
35 |
data = {
|
36 |
'list_id': grups_id,
|
37 |
'email': emails,
|
38 |
'values': [
|
39 |
-
{'value': names, 'parameter_id': '
|
40 |
-
{'value': phones, 'parameter_id': '
|
41 |
-
{'value':
|
42 |
-
{'value':
|
43 |
]
|
44 |
}
|
45 |
|
@@ -58,7 +46,7 @@ def save_db():
|
|
58 |
|
59 |
response_data = {
|
60 |
"status": "success" if err == 1 else "error",
|
61 |
-
|
62 |
}
|
63 |
|
64 |
return jsonify(response_data)
|
|
|
3 |
import requests
|
4 |
import globs
|
5 |
|
|
|
|
|
|
|
|
|
6 |
api_key = os.getenv('api_key')
|
7 |
base_url = os.getenv('base_url') # URL сервера, например, 'https://api.notisend.ru/v1/email/'
|
8 |
token = os.getenv('token') # Ваш токен
|
9 |
|
10 |
+
def add_user():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
err = 0
|
12 |
|
13 |
if api_key == request.args.get('api'):
|
|
|
16 |
emails = globs.email
|
17 |
phones = globs.phone
|
18 |
grups_id = globs.grup_id # Это List ID
|
19 |
+
pr1s = globs.pr1
|
20 |
+
pr2s = globs.pr2
|
21 |
|
22 |
# Создаем данные для отправки
|
23 |
data = {
|
24 |
'list_id': grups_id,
|
25 |
'email': emails,
|
26 |
'values': [
|
27 |
+
{'value': names, 'parameter_id': 'nam1'},
|
28 |
+
{'value': phones, 'parameter_id': 'pho2'},
|
29 |
+
{'value': pr1s, 'parameter_id': 'pr13'},
|
30 |
+
{'value': pr2s, 'parameter_id': 'pr24'}
|
31 |
]
|
32 |
}
|
33 |
|
|
|
46 |
|
47 |
response_data = {
|
48 |
"status": "success" if err == 1 else "error",
|
49 |
+
"err": err
|
50 |
}
|
51 |
|
52 |
return jsonify(response_data)
|