|
def send_ns(base_url, token, list_id, email, phone, name, name_id, phone_id): |
|
"""Функция для отправки запроса на сервер.""" |
|
data = { |
|
"email": email, |
|
"unconfirmed": False, |
|
"values": [ |
|
|
|
{ |
|
"parameter_id": phone_id, |
|
"kind": "string", |
|
"list_id": list_id, |
|
"title": "phone", |
|
"value": phone |
|
}, |
|
{ |
|
"parameter_id": name_id, |
|
"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() |