Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,50 +27,54 @@ def send_request():
|
|
| 27 |
@app.route('/save_db', methods=['GET'])
|
| 28 |
def save_db():
|
| 29 |
show_params = False
|
| 30 |
-
|
| 31 |
name = request.args.get('name')
|
| 32 |
-
|
|
|
|
| 33 |
phone = request.args.get('phone')
|
| 34 |
-
|
| 35 |
pr1 = request.args.get('pr1')
|
|
|
|
| 36 |
pr2 = request.args.get('pr2')
|
|
|
|
| 37 |
pr3 = request.args.get('pr3')
|
|
|
|
| 38 |
data = {
|
| 39 |
"email": email,
|
| 40 |
"unconfirmed": False,
|
| 41 |
"values": [
|
| 42 |
{
|
| 43 |
-
"parameter_id":
|
| 44 |
"kind": "string",
|
| 45 |
"list_id": 557103,
|
| 46 |
"title": "pr3",
|
| 47 |
"value": pr3
|
| 48 |
},
|
| 49 |
{
|
| 50 |
-
"parameter_id":
|
| 51 |
"kind": "string",
|
| 52 |
-
"list_id":
|
| 53 |
"title": "pr2",
|
| 54 |
"value": pr2
|
| 55 |
},
|
| 56 |
{
|
| 57 |
-
"parameter_id":
|
| 58 |
"kind": "string",
|
| 59 |
-
"list_id":
|
| 60 |
"title": "pr1",
|
| 61 |
"value": pr1
|
| 62 |
},
|
| 63 |
{
|
| 64 |
-
"parameter_id":
|
| 65 |
"kind": "string",
|
| 66 |
-
"list_id":
|
| 67 |
"title": "phone",
|
| 68 |
"value": phone
|
| 69 |
},
|
| 70 |
{
|
| 71 |
-
"parameter_id":
|
| 72 |
"kind": "string",
|
| 73 |
-
"list_id":
|
| 74 |
"title": "name",
|
| 75 |
"value": name
|
| 76 |
}
|
|
@@ -81,7 +85,7 @@ def save_db():
|
|
| 81 |
'Authorization': f'Bearer {token}',
|
| 82 |
'Content-Type': 'application/json'
|
| 83 |
}
|
| 84 |
-
response = requests.post(f"{base_url}/email/lists/{
|
| 85 |
|
| 86 |
if show_params:
|
| 87 |
system_vars = {
|
|
|
|
| 27 |
@app.route('/save_db', methods=['GET'])
|
| 28 |
def save_db():
|
| 29 |
show_params = False
|
| 30 |
+
list_id = request.args.get('list_id')
|
| 31 |
name = request.args.get('name')
|
| 32 |
+
name_id = request.args.get('name_id')
|
| 33 |
+
email = request.args.get('email')
|
| 34 |
phone = request.args.get('phone')
|
| 35 |
+
phone_id = request.args.get('phone_id')
|
| 36 |
pr1 = request.args.get('pr1')
|
| 37 |
+
pr1_id = request.args.get('pr1_id')
|
| 38 |
pr2 = request.args.get('pr2')
|
| 39 |
+
pr2_id = request.args.get('pr2_id')
|
| 40 |
pr3 = request.args.get('pr3')
|
| 41 |
+
pr3_id = request.args.get('pr3_id')
|
| 42 |
data = {
|
| 43 |
"email": email,
|
| 44 |
"unconfirmed": False,
|
| 45 |
"values": [
|
| 46 |
{
|
| 47 |
+
"parameter_id": pr3_id,
|
| 48 |
"kind": "string",
|
| 49 |
"list_id": 557103,
|
| 50 |
"title": "pr3",
|
| 51 |
"value": pr3
|
| 52 |
},
|
| 53 |
{
|
| 54 |
+
"parameter_id": pr2_id,
|
| 55 |
"kind": "string",
|
| 56 |
+
"list_id": list_id,
|
| 57 |
"title": "pr2",
|
| 58 |
"value": pr2
|
| 59 |
},
|
| 60 |
{
|
| 61 |
+
"parameter_id": pr1_id,
|
| 62 |
"kind": "string",
|
| 63 |
+
"list_id": list_id,
|
| 64 |
"title": "pr1",
|
| 65 |
"value": pr1
|
| 66 |
},
|
| 67 |
{
|
| 68 |
+
"parameter_id": phone_id,
|
| 69 |
"kind": "string",
|
| 70 |
+
"list_id": list_id,
|
| 71 |
"title": "phone",
|
| 72 |
"value": phone
|
| 73 |
},
|
| 74 |
{
|
| 75 |
+
"parameter_id": name_id,
|
| 76 |
"kind": "string",
|
| 77 |
+
"list_id": list_id,
|
| 78 |
"title": "name",
|
| 79 |
"value": name
|
| 80 |
}
|
|
|
|
| 85 |
'Authorization': f'Bearer {token}',
|
| 86 |
'Content-Type': 'application/json'
|
| 87 |
}
|
| 88 |
+
response = requests.post(f"{base_url}/email/lists/{list_id}/recipients", json=data, headers=headers)
|
| 89 |
|
| 90 |
if show_params:
|
| 91 |
system_vars = {
|