Spaces:
Sleeping
Sleeping
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() | |