feat: remove duplicate emails ignoring case in Personalization#924
Conversation
|
The setters currently don't work for lists of strings or lists of tuples. Wasn't sure if they're needed for this feature, but let me know what you think of them and the expected behavior for if they're used. At the moment, this will raise an |
eshanholtz
left a comment
There was a problem hiding this comment.
Generally this looks good, but doesn't work when using just the add_to/add_cc/add_bcc functions:
p = Personalization()
to_email = To('test+to@example.com', 'Example To Name 0')
p.add_to(to_email)
p.add_to(to_email)Since there are several ways of setting/adding emails to these fields, and each set would result in a call to _get_unique_recipients, why not just use that function once in each of the getters? For example:
@property
def tos(self):
return _get_unique_recipients(self._tos)|
Going to get into updating this soon. Been extremely busy this last month, but going to make time for this when I can. Haven't forgotten this! |
…com:DougCal/sendgrid-python into remove_duplicate_emails_in_Personalizations
|
@eshanholtz ready for re-review! Loved the suggestion- cleaned up the code a lot. I tested making requests locally to be sure it prevented the duplicate email error and it worked quite well. |
eshanholtz
left a comment
There was a problem hiding this comment.
LGTM! Thank you for the contribution!
Fixes #788
This removes duplicate emails on setting the Personalization object, ignoring case.