DmitrMakeev
commited on
Commit
•
6c6720d
1
Parent(s):
42daeb3
Create ns.py
Browse files
ns.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def send_request(list_id, email, phone, name, param_name, param_phone, pr5, pr4, pr3, pr2, pr1, pr5_id, pr4_id, pr3_id, pr2_id, pr1_id):
|
2 |
+
"""Функция для отправки запроса на сервер."""
|
3 |
+
data = {
|
4 |
+
"email": email,
|
5 |
+
"unconfirmed": False,
|
6 |
+
"values": [
|
7 |
+
{
|
8 |
+
"parameter_id": pr5_id,
|
9 |
+
"kind": "string",
|
10 |
+
"list_id": list_id,
|
11 |
+
"title": "pr5",
|
12 |
+
"value": pr5
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"parameter_id": pr4_id,
|
16 |
+
"kind": "string",
|
17 |
+
"list_id": list_id,
|
18 |
+
"title": "pr4",
|
19 |
+
"value": pr4
|
20 |
+
},
|
21 |
+
{
|
22 |
+
"parameter_id": pr3_id,
|
23 |
+
"kind": "string",
|
24 |
+
"list_id": list_id,
|
25 |
+
"title": "pr3",
|
26 |
+
"value": pr3
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"parameter_id": pr2_id,
|
30 |
+
"kind": "string",
|
31 |
+
"list_id": list_id,
|
32 |
+
"title": "pr2",
|
33 |
+
"value": pr2
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"parameter_id": pr1_id,
|
37 |
+
"kind": "string",
|
38 |
+
"list_id": list_id,
|
39 |
+
"title": "pr1",
|
40 |
+
"value": pr1
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"parameter_id": param_phone,
|
44 |
+
"kind": "string",
|
45 |
+
"list_id": list_id,
|
46 |
+
"title": "phone",
|
47 |
+
"value": phone
|
48 |
+
},
|
49 |
+
{
|
50 |
+
"parameter_id": param_name,
|
51 |
+
"kind": "string",
|
52 |
+
"list_id": list_id,
|
53 |
+
"title": "name",
|
54 |
+
"value": name
|
55 |
+
}
|
56 |
+
]
|
57 |
+
}
|
58 |
+
|
59 |
+
headers = {
|
60 |
+
'Authorization': f'Bearer {token}',
|
61 |
+
'Content-Type': 'application/json'
|
62 |
+
}
|
63 |
+
response = requests.post(f"{base_url}/email/lists/{list_id}/recipients", json=data, headers=headers)
|
64 |
+
return response.json()
|