[](https://travis-ci.org/vikingco/wingmonkey)
# wingmonkey
mailchimp api v3 client
mailchimp v3 api reference documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/overview/
### Settings
To be able to make calls to mailchimp without having to initialize a custom MailChimpSession yourself make sure that at least following environment variable is set (or added to a .env file):
```python
DEFAULT_MAILCHIMP_API_KEY=<YOUR MAILCHIMP API KEY>
```
For more advanced usage you can pass a custom MailChimpSession to the serializers and functions:
```
from wingmonkey.mailchimp_session import MailChimpSession
from wingmonkey.lists import ListSerializer
session = MailChimpSession(api_endpoint=<YOUR MAILCHIMP BASE URL>, api_key=<YOUR MAILCHIMP API KEY>)
list_serializer = ListSerializer(session=session)
```
### Some more usage examples:
#### getting list info
```python
from wingmonkey.lists import ListSerializer
list_serializer = ListSerializer()
list_id = 'A_VALID_LIST_ID'
my_list = list_serializer.read(list_id=list_id)
name = my_list.name
total_subscribers = my_list.stats['member_count']
unsubscribe_count = my_list.stats['unsubscribe_count']
```
#### creating new member
```python
from wingmonkey.members import Member, MemberSerializer
email_address = 'monkeysee@monkey.do'
merge_fields = {FNAME: 'Ceasar', LNAME: 'Chimp'}
language = 'en'
list_id = 'A_VALID_LIST_ID'
member_to_add = Member(
email_address=email_address,
merge_fields=merge_fields,
language=language,
list_id=list_id
)
member_serializer = MemberSerializer()
newly_added_member = member_serializer.create(list_id=list_id, instance=member_to_add)
```
#### get all members of a list
```python
from wingmonkey.async_operations import get_all_members_async
from datetime import datetime, timedelta
list_id = 'A_VALID_LIST_ID'
```
* all members
```python
all_list_members = get_all_members_async(list_id=list_id)
```
* all members updated since specific date (take care to use the correct string format for datetime)
```python
date_since = datetime.strftime(datetime.now() - timedelta(days=1), '%Y-%m-%dT%H:%M:%S')
extra_params = {'since_last_changed': date_since }
all_updated_members_since_yesterday = get_all_members_async(list_id=list_id, extra_params=extra_params)
```
#### batch update of a large list of members
* This will return a list of corresponding batch operation resources (1 for every 500 members)
http://developer.mailchimp.com/documentation/mailchimp/reference/batches/#create-post_batches
http://developer.mailchimp.com/documentation/mailchimp/reference/lists/#create-post_lists_list_id
```python
from wingmonkey.async_operations import batch_update_members_async
list_id = 'A_VALID_LIST_ID'
member_list = [A_LIST_OF_MEMBER_INSTANCES]
batch_operation_resource_list = batch_update_members_async(list_id=list_id, member_list=member_list)
```
Metadata
Release files for wingmonkey 0.1.21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wingmonkey-0.1.21.tar.gz | 28.6 kB | Without provenance | Details for wingmonkey-0.1.21.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wingmonkey-0.1.21-py3-none-any.whl | Python 3 | none | any | Details for wingmonkey-0.1.21-py3-none-any.whl |
Total release size: 68.3 kB
Release files / wingmonkey-0.1.21.tar.gz
| Download URL | wingmonkey-0.1.21.tar.gz |
|---|---|
| Size | 28.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5b7c2b00fc42ee13758d1fd9d178491a727564ef5dcb8a5e6da708b990cf85d
|
|
BLAKE2b-256 checksum How to use checksums |
9ed11721f585134342403bd7e45a165ae0a4687983b23648631bdee17f89245f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Release files / wingmonkey-0.1.21-py3-none-any.whl
| Download URL | wingmonkey-0.1.21-py3-none-any.whl |
|---|---|
| Size | 39.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c6653dc59dba701cb33253772ce66ac407db20763a55a27be6873251679367f
|
|
BLAKE2b-256 checksum How to use checksums |
b7a47e11cb17509172794f148f82484fefd74a7a928a50bee2dadb2553bfbe59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Security for wingmonkey 0.1.21
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.