我尝试过:
client.lists.members.create('1111111', {
'email_address' : '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f89e8a979f9f9d8ac9c9ceb89f95999194d69b9795" rel="noreferrer noopener nofollow">[email protected]</a>',
'status' : 'subscribed',
"tags": [{'name': 'frogger', 'status' : 'active'}],
})
并得到:
mailchimp3.mailchimpclient.MailChimpError: {
'type': 'http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/',
'title': 'Invalid Resource',
'status': 400,
'detail': 'Expected argument of type "string", "stdClass" given',
'instance': '5ae1b966-ed35-49f1-ad32-0a39c3d63593'
}
没有“tags”行,语句就可以工作
最佳答案
这对我有用(您需要对电子邮件地址进行哈希处理)
hash = get_subscriber_hash(email_address)
data = {
'tags': [
{'name': 'foo', 'status': 'active'},
{'name': 'bar', 'status': 'inactive'}
]
}
client.lists.members.tags.update(list_id=list_id, subscriber_hash=hash, data=data)
关于rest - mailchimp3 (Python-mailchimp-api) 如何设置标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61209207/