Skip to main content

A python client for MailChimp Marketing API, with batch support

Project description

PyPI Package latest release License

A light wrapper around mailchimp-marketing that makes it easier to use batch operations.

Getting Started

Installation

pip install batch-mailchimp

Usage

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

API Structure and Endpoints

The API structure and endpoints match that of mailchimp-marketing. You should refer to their documentation for usage.

Support

If you are having issues, please create an issue.

License

The project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

batch-mailchimp-1.2.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

batch_mailchimp-1.2.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file batch-mailchimp-1.2.0.tar.gz.

File metadata

  • Download URL: batch-mailchimp-1.2.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for batch-mailchimp-1.2.0.tar.gz
Algorithm Hash digest
SHA256 dbd4e013ef1cc53f4787db80e9a41e324c8242c895f2b8bb5534cf76466a4927
MD5 da92f319d2355e6d0eeb23edbdea595d
BLAKE2b-256 2a6f73c7db5048c4d0504213fe65f77e58df588331d3206e65835a4e0d34483f

See more details on using hashes here.

File details

Details for the file batch_mailchimp-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for batch_mailchimp-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20ad7997258247620161ec0d013cccfb019a93746b131f6d604568ab5cabf36a
MD5 f40abf2660a88bf877746f88d00c462e
BLAKE2b-256 9367ad2bf0b5b85db3181d9a53b8b73ff1d32a5c3b258c346aa80a8a8ff1664a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page