-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate type of recipients #141
Conversation
test/test_transmissions.py
Outdated
@@ -28,6 +28,19 @@ def test_translate_keys_with_recips(): | |||
{'key': 'value'}, | |||
{'address': {'email': 'foobar'}}] | |||
|
|||
results = t._translate_keys( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this testing differently than the above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wanted to test a different data structure but looks like redundant. i've removed it.
sparkpost/transmissions.py
Outdated
@@ -137,6 +138,10 @@ def _parse_address(self, address): | |||
return parsed_address | |||
|
|||
def _extract_recipients(self, recipients): | |||
|
|||
if not (isinstance(recipients, list) or isinstance(recipients, dict)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pass a tuple as the second argument to isinstance
like so:
isinstance(recipients, (list, dict))
@richleland done with requested changes |
Resolves #138