Skip to main content

A python client for v3 of MailChimp API, with batch support

Project description

A light wrapper around mailchimp3 that makes it easier to use batch operations.

Getting Started

Installation

pip install batch-mailchimp

Initialization

This can be used as a drop-in replacement for mailchimp3 – just change the import at the top:

from batch_mailchimp import BatchMailChimp as MailChimp

client = MailChimp(mc_api='YOUR_API_KEY', mc_user='YOUR_USERNAME')

Examples

You can use this exactly as you would the mailchimp3 library. The addition is the Batch class, for keeping track of batch operations. To use it, first create a new batch, then include it in an API call via the batch keyword argument.

from batch_mailchimp import Batch, BatchMailChimp as MailChimp

client = MailChimp(mc_api='YOUR_API_KEY', mc_user='YOUR_USERNAME')

# create a batch object...
my_batch = Batch()

# add John Doe with email john.doe@example.com to list matching id '123456'
client.lists.members.create('123456', {
        'email_address': 'john.doe@example.com',
        'status': 'subscribed',
        'merge_fields': {
            'FNAME': 'John',
            'LNAME': 'Doe',
        },
    },
    batch=my_batch,  # ...and include it in an API call.
)

The API call won’t fire immediately, but will instead be added to the batch. When you’re ready, run the batch:

my_batch.run()

You can check the status of your batch operation using:

my_batch.status()

You can also delete your batch operation using:

my_batch.delete()

API Structure and Endpoints

The API Structure matches that of mailchimp3. You should refer to their documentation for usage.

Endpoints are also the same, except for the addition of the batch keyword.

Support

If you are having issues, please create an issue or submit a pull request.

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-0.0.2.tar.gz (3.2 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: batch-mailchimp-0.0.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.0

File hashes

Hashes for batch-mailchimp-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7c21b771e48b6b979e5751f75327ea09ca7145085d009d9c9b796bbffb0be8bc
MD5 7ac24f7ece039f4728f7ee5bb7ecc475
BLAKE2b-256 f6fef61cd3b3798f8dd210a3b6970458c6a14323a5db169e5934ba4cc4e1c681

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