postmarker icon indicating copy to clipboard operation
postmarker copied to clipboard

Suggestion: better documentation of `emails` parameter for send_batch and send_template_batch

Open gregsadetsky opened this issue 3 years ago • 2 comments

The documentation for send_batch and send_template_batch both mention:

Parameters emails – Email instances or dictionaries

However, emails is actually equivalent to *args, i.e. emails internally captures (within send_batch and send_template_batch) all arguments passed to the function. The variable name emails is not actually exposed to the caller, and so isn't properly a "parameter".

Calling:

postmark.emails.send_batch(emails=[email, another_email])

will not work -- the function will instead confusingly return an empty array.

Just in case anybody comes here to troubleshoot this, the correct way to call the functon is rather:

postmark.emails.send_batch(email, another_email)
# ... or alternatively ...
my_emails = [email, another_email]
postmark.emails.send_batch(*my_emails)

Thanks!

gregsadetsky avatar May 11 '22 15:05 gregsadetsky

Thanks @gregsadetsky that was exactly what I was searching for.

digicase avatar May 24 '22 12:05 digicase