Closed hubbs5 closed 3 years ago
Hi, You can try next code:
for email in emails:
result = client.contact.get(id=email).json()
And as a result, you will get:
{'Count': 1, 'Data': [{'CreatedAt': '2021-06-30T15:14:29Z', 'DeliveredCount': 0, 'Email': 'a@mailjet.com', 'ExclusionFromCampaignsUpdatedAt': '', 'ID': 3735154751, 'IsExcludedFromCampaigns': False, 'IsOptInPending': False, 'IsSpamComplaining': False, 'LastActivityAt': '', 'LastUpdateAt': '', 'Name': 'a', 'UnsubscribedAt': '', 'UnsubscribedBy': ''}], 'Total': 1}
{'Count': 1, 'Data': [{'CreatedAt': '2021-06-30T15:14:29Z', 'DeliveredCount': 0, 'Email': 'b@mailjet.com', 'ExclusionFromCampaignsUpdatedAt': '', 'ID': 3735154752, 'IsExcludedFromCampaigns': False, 'IsOptInPending': False, 'IsSpamComplaining': False, 'LastActivityAt': '', 'LastUpdateAt': '', 'Name': 'b', 'UnsubscribedAt': '', 'UnsubscribedBy': ''}], 'Total': 1}
{'Count': 1, 'Data': [{'CreatedAt': '2021-06-30T15:14:29Z', 'DeliveredCount': 0, 'Email': 'c@mailjet.com', 'ExclusionFromCampaignsUpdatedAt': '', 'ID': 3735154753, 'IsExcludedFromCampaigns': False, 'IsOptInPending': False, 'IsSpamComplaining': False, 'LastActivityAt': '', 'LastUpdateAt': '', 'Name': 'c', 'UnsubscribedAt': '', 'UnsubscribedBy': ''}], 'Total': 1}
Is this a thing what are you looking for?
Yes! That's the output. Still doesn't address the issue with .filter()
but that at least solves the issue I was having.
I'm trying to filter on email addresses to get IDs to make updates to my contacts, but the function is returning the top 10 emails by default.
This also appears to be an issue missed in the
test.py
file (see lines 68-71 here). Building off of the test example, this code shows that all three emails are returned each time. As long as the test is only checking for the email in the 0 position, it will pass.I want to be able to return the info associated with one email address, but with this filter behaviour, it will force me to get all of my emails at sort through those each time I query it. I can do this with a small list, but would much rather have the filter argument return only one email address so I can get my IDs. Is there another way to do this?