【发布时间】:2019-03-13 14:07:15
【问题描述】:
我正在尝试使用 Mailchimp API 的批处理功能。我现在的设置是这样的
operations = []
for idx, row in users_df.iterows():
payload = {
'email': row['email'],
'last_updated': row['new_time'],
'custom_value': row['new_value']
}
operation_item = {
"method": "POST", # I changed this to PUT
"path": '/lists/members/12345',
"body": json.dumps(payload),
}
operations.append(operation_item)
client = mc.MailChimp(MAILCHIMP_TOKEN, MAILCHIMP_USER)
batch = client.batches.create(data={"operations": operations})
每当我使用 POST 方法时,我都会收到此错误:old_user@gmail.com is already a list member. Use PUT to insert or update list members.
但每当我将方法更改为 PUT 时,我都会收到另一个错误:The requested method and resource are not compatible. See the Allow header for this resource's available methods.
【问题讨论】:
标签: python python-requests mailchimp