File size: 1,974 Bytes
a754e6c 6c6720d |
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 |
def send_ns(list_id, email, phone, name, param_name, param_phone, pr5, pr4, pr3, pr2, pr1, pr5_id, pr4_id, pr3_id, pr2_id, pr1_id):
"""Функция для отправки запроса на сервер."""
data = {
"email": email,
"unconfirmed": False,
"values": [
{
"parameter_id": pr5_id,
"kind": "string",
"list_id": list_id,
"title": "pr5",
"value": pr5
},
{
"parameter_id": pr4_id,
"kind": "string",
"list_id": list_id,
"title": "pr4",
"value": pr4
},
{
"parameter_id": pr3_id,
"kind": "string",
"list_id": list_id,
"title": "pr3",
"value": pr3
},
{
"parameter_id": pr2_id,
"kind": "string",
"list_id": list_id,
"title": "pr2",
"value": pr2
},
{
"parameter_id": pr1_id,
"kind": "string",
"list_id": list_id,
"title": "pr1",
"value": pr1
},
{
"parameter_id": param_phone,
"kind": "string",
"list_id": list_id,
"title": "phone",
"value": phone
},
{
"parameter_id": param_name,
"kind": "string",
"list_id": list_id,
"title": "name",
"value": name
}
]
}
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
response = requests.post(f"{base_url}/email/lists/{list_id}/recipients", json=data, headers=headers)
return response.json()
|