Usage>>> from campaignmonitorapi import CampaignMonitorApi
>>> cm = CampaignMonitorApi("YOUR API KEY", None)
>>> listid = 12345
>>> email = "nowhere@gmail.com"
>>> name = "Grant"
>>> cm.subscriber_add(listid, email, name)
TrueExceptionsA CampaignMonitorApi.CampaignMonitorApiException is thrown if Campaign Monitor returns an exception. "OK" return codes are ignored. The returned code is currently not included in the exception - the message is passed to the exception. Tips- When you "subscriber_add", the email address goes into the standard verification loops at Campaign Monitor. So, if you're set to double-opt-in, you'll need to click the link in the resultant confirmation email before calling the subscribers_get_is_subscribed() method. (It will return False until you've verified.)
- The subscriber_add() and subscriber_add_and_resubscribe() methods both support custom fields. Rather than map directly to the CM API (where the custom fields options are implemented as separate methods), the Python API has just two methods, with an optional parameter for the custom fields. If you pass custom fields, the appropriate "*WithCustomFields" API method will be called.
- When running the unit tests, be aware that the "subscriber_add" test will fail if the email address specified is already in the list you are testing with, or the associated suppression list for the client. There are notes in the test file for how to handle this.
|