A light wrapper around mailchimp-marketing that makes it easier to use batch operations.
pip install batch-mailchimp
This can be used as a drop-in replacement for mailchimp-marketing – just change the import at the top, and everything should work the same:
import batch_mailchimp as MailchimpMarketing
client = MailchimpMarketing.Client({
"api_key": "YOUR_API_KEY",
})
The additional functionality comes when we initialise the client with batch=True
:
import batch_mailchimp as MailchimpMarketing
client = MailchimpMarketing.Client({
"api_key": "YOUR_API_KEY",
"batch": True,
})
If we do this, operations are stored up in the client, to be run later. For example:
# Fetch all MailChimp lists
client.lists.get_all_lists()
All new operations will be added to the batch. When we’re ready, we can run all the operations in the batch:
batch = batch_client.batches.run()
We can check the batch’s status using:
batch.status(refresh=True)
Once it has finished, we can get the response with:
response = batch.response()
response.body
The API structure and endpoints match that of mailchimp-marketing. You should refer to their documentation for usage.
If you are having issues, please create an issue.
The project is licensed under the MIT License.