-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeleteContacts.py
28 lines (23 loc) · 989 Bytes
/
deleteContacts.py
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
import ElasticEmail
from ElasticEmail.apis.tags import contacts_api
from ElasticEmail.model.emails_payload import EmailsPayload
# Defining the host is optional and defaults to https://api.elasticemail.com/v4
configuration = ElasticEmail.Configuration()
# Configure API key authorization: apikey
configuration.api_key['apikey'] = 'YOUR_API_KEY'
"""
Delete contact
Example api call that deletes given contact(s).
"""
with ElasticEmail.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = contacts_api.ContactsApi(api_client)
emails_payload = EmailsPayload(
Emails=["[email protected]"],
) # EmailsPayload | Provide either rule or a list of emails, not both.
try:
# Delete Contacts Bulk
api_instance.contacts_delete_post(emails_payload)
print("Contacts deleted.")
except ElasticEmail.ApiException as e:
print("Exception when calling ContactsApi->contacts_delete_post: %s\n" % e)