File size: 926 Bytes
c2e0110
c5553e9
 
 
 
 
ec7b3b2
c5553e9
2a6bd09
c5553e9
2a6bd09
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
26
27
28
29
30
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()