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