File size: 723 Bytes
fec90c6
 
 
c5553e9
 
 
 
 
 
2a6bd09
c5553e9
 
 
2a6bd09
c5553e9
 
 
 
 
 
 
 
 
 
 
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
import requests

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