使用 mailchimp_transactional 客户端有什么问题?



我得到这个错误:

File "/Users/hernan0216/services/project/services/email.py", line 84, in _send_template
result = self.client.messages.send_template(**data)
File "/Users/hernan0216/services/venv/lib/python3.6/site-packages/mailchimp_transactional/api/messages_api.py", line 422, in send_template
(data) = self.send_template_with_http_info(body, **kwargs)  # noqa: E501
File "/Users/hernan0216/services/venv/lib/python3.6/site-packages/mailchimp_transactional/api/messages_api.py", line 438, in send_template_with_http_info
" to method send_template" % key
TypeError: Got an unexpected keyword argument 'template_name' to method send_template

数据应该类似于这个

data = {'template_name': 'name_template', 'template_content': [], 'message': {'from_email': 'noreply@ex.com', 'from_name': 'Ex', 'subject': "some string", 'to': [{'email': 'ex@example.com', 'name': 'Example', 'type': 'to'}], 'global_merge_vars': [{'name': 'STUDENT_NAME', 'content': 'Example Name'}]}}

在mailchimp api文档中为send_template方法指定了Like

在mailchimp_transactional客户端中,我发现了这段代码,即只接受";身体;作为关键字参数,我应该打开一个问题吗?应该在客户端、文档还是api上??也许我错过了什么,如果是这样的话,对不起。

只需将其作为常规body参数而不是关键字参数传递即可,无需**。关键字params语法必须在传统的Mandrill Python API中使用,Mailchimp Transactional API不需要它

result = self.client.messages.send_template(data)

最新更新