1. MM Accounts¶
The accounts module contains interfaces for all of the various Account
management features offered by the dyn Message Management REST API
1.1. Search/List Functions¶
The following functions return a single list containing class representations
of their respective types. For instance
get_all_users() returns a list of User objects.
-
dyn.mm.accounts.get_all_accounts()[source]¶ Return a list of all
Account‘s accessible to the currently authenticated user
-
dyn.mm.accounts.get_all_senders(start_index=0)[source]¶ Return a list of all
ApprovedSenders‘s accessible to the currently authenticated user
-
dyn.mm.accounts.get_all_suppressions(startdate=None, enddate=None, startindex=0)[source]¶ Return a list of all
Suppression‘s
1.2. Account¶
-
class
dyn.mm.accounts.Account(username, *args, **kwargs)[source]¶ A Message Management account instance. password, companyname, and phone are required for creating a new account. To access an existing Account, simply provide the username of the account you wish to access.
-
__init__(username, *args, **kwargs)[source]¶ Create a new
AccountobjectParameters: - username – The username for this
Account- must be a valid email address, and must be unique among all other sub-accounts. - password –
Accountpassword to be assigned. May be passed as clear text or MD5-encrypted with “md5-” as a prefix - companyname – Name of the company assigned to this
Account - phone – Contact Phone number for this
Account - address – The primary address associated with this
Account - city – The City associated with this
Account - state – The State associated with this
Account - zipcode – The Zipcode associated with this
Account - country – Two-letter English ISO 3166 country code
- timezone – The timezone of the account, in [+/-]h.mm format
- bounceurl – Bounce postback URL
- spamurl – Spam postback URL
- unsubscribeurl – Unsubscribe postback URL
- trackopens – Toggle open tracking (1 or 0).
- tracklinks – Toggle click tracking (1 or 0).
- trackunsubscribes – Toggle automatic list-unsubscribe support (1 or 0).
- generatenewapikey – Used to create a new API key for an existing account (1 or 0).
- username – The username for this
-
account_name¶
-
apikey¶ The apikey for this account
-
created¶
-
email_sent¶
-
emailcap¶
-
max_sample_count¶
-
password¶ The password for this
Account. Note: Unless you’ve just created thisAccount, this field will be None.
-
track_links¶ A settings flag determining whether or not emails sent from this
Accountwill be monitored for followed links
-
track_opens¶ A settings flag determining whether or not emails sent from this
Accountwill be monitored for opens
-
track_unsubscribes¶ A settings flag determining whether or not emails sent from this
Accountwill be monitored for unsubscribes
-
uri= '/accounts'¶
-
user_type¶
-
1.2.1. Create a new Account¶
The following example shows how to create a new Account
on the Dyn Message Management system:
>>> from dyn.mm.accounts import Account
>>> new_account = Account('username', 'password', 'companyname', '1 (603) 867-5309')
>>> new_account
<MM Account>: username
>>> new_account.xheaders
{}
1.2.2. Using an Existing Account¶
The following example shows how to get an do some simple manipulation of an existing dyn Message Management account:
>>> from dyn.mm.accounts import Account
>>> new_account = Account('username')
>>> new_account.apikey
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
>>> new_account.generate_new_apikey()
>>> new_account.apikey
'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
>>> new_account.xheaders
{'xheader1': '', 'xheader2': '', 'xheader3': '', 'xheader4': ''}
>>> # The following creates a new xheader for the account
>>> new_account.xheaders['xheader3'] = 'X-header3_data'
1.3. Approved Sender¶
-
class
dyn.mm.accounts.ApprovedSender(emailaddress, *args, **kwargs)[source]¶ An email address that is able to be used in the “from” field of messages
-
__init__(emailaddress, *args, **kwargs)[source]¶ Create an
ApprovedSenderobjectParameters: - emailaddress – The email address of this
ApprovedSender - seeding – 1 to opt this approved sender in for seeding; 0 (default)to opt them out. Seeding is used to provide insight into inbox placement. See the Approved Senders. page for more information.
- emailaddress – The email address of this
-
delete()[source]¶ Delete this
ApprovedSender
-
dkim¶ DKIM identifier for this approved sender - identifier may contain only aplanumeric characters, dashes, or underscores.
-
dkimval¶ DKIM val for this
ApprovedSender
-
seeding¶ 1 to opt this approved sender in for seeding; 0 to opt them out (default). Seeding is used to provide insight into inbox placement. See the Approved Senders. page for more information.
-
spf¶ SPF for this
ApprovedSender
-
status¶ Retrieves the status of an approved sender – whether or not it is ready for use in sending. This is most useful when you create a new approved sender and need to know for sure whether it is ready for use.
-
uri= '/senders'¶
-
1.3.1. Create a new Approved Sender¶
Approved senders are pretty straightforward as far as functionality goes but here
we’ll see how to create a new ApprovedSender:
>>> from dyn.mm.accounts import ApprovedSender
>>> sender = ApprovedSender('username@email.com', seeding=0)
>>> sender.status
1
>>> sender.seeding
0
>>> sender.seeding = 1
1.4. Recipient¶
-
class
dyn.mm.accounts.Recipient(emailaddress, method='GET')[source]¶ A
Recipientis an email address that is capable of recieving email.-
__init__(emailaddress, method='GET')[source]¶ Create a
RecipientobjectParameters: - emailaddress – This
Recipient‘s email address. - method – A Flag specifying whether you’re looking for an existing
Recipientor if you want to create a new one. Because both GET and POST calls accept the same requirements there’s no way to automatically deduce what the user is trying to do so you must specify either GET or POST in the constructor
- emailaddress – This
-
1.4.1. Creating/Using Recipients¶
Recipients are the one model you’ll find in this library that don’t have an intuitive way to distinguish what you’re trying to accomplish simply from the arguments you provide at create time. Because of this, you’ll need to pass a method type, either GET or POST, to the Recipient when you create it:
>>> from dyn.mm.accounts import Recipient
>>> recipient = Recipient('user@email.com', method='POST')
>>> recipient.status
'inactive'
>>> recipient.activate()
>>> recipient.status
'active'
1.5. Suppression¶
-
class
dyn.mm.accounts.Suppression(emailaddress, *args, **kwargs)[source]¶ A
Supressionrepresenting a suppressed email-
__init__(emailaddress, *args, **kwargs)[source]¶ Create a
Suppressionobject.Parameters: emailaddress – This email address of for the Suppression‘s to apply to.
-
activate()[source]¶ Removes a
Recipientfrom the user’s suppression list. This will not unbounce/uncomplain theRecipient, but you will be permitted to send to them again.
-
count¶ the total number of email addresses in the suppression list for the specified account, filtered by date range.
-
get_count(startdate=None, enddate=None)[source]¶ Get the count attribute of this suppression for the provided range
-
uri= '/suppressions'¶
-