Skip to main content

A python client for v3 of MailChimp 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:

# 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',
        },
    },
)

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()

API Structure and Endpoints

The API structure and endpoints match that of mailchimp3. 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.0.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

batch_mailchimp-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: batch-mailchimp-1.0.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.0.0.tar.gz
Algorithm Hash digest
SHA256 e1d97fbf7a2ab8f36e102453833b31a2684136e14c3735aef82c9821f132916c
MD5 61203045498b7c82f627943741ae0161
BLAKE2b-256 bbb4e5301af8c2815ddf85235d7f94c0be08a5a800a9e071e84232bfcce02489

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for batch_mailchimp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a10afc1bea5af7b5bc5ef6b70e6ea6516fb81f7ca399de70d3f92c3149ecdf0a
MD5 0b88bd97b3c2a45158c57200df108158
BLAKE2b-256 01425eeab67742ea075aca5dde46c8e5672a2d7edcbbe3d171bd4dc05bd240f0

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