up_fail / ns.py
DmitrMakeev's picture
Update ns.py
0e795a4 verified
raw
history blame
909 Bytes
def send_ns(id_list, email, phone, name, id_name, id_phone):
"""Функция для отправки запроса на сервер."""
data = {
"email": email,
"unconfirmed": False,
"values": [
{
"parameter_id": id_phone,
"kind": "string",
"list_id": id_list,
"title": "phone",
"value": phone
},
{
"parameter_id": id_name,
"kind": "string",
"list_id": id_list,
"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()