コード例 #1
0
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.trigger = Trigger(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'trigger_id': 200,
             'start_ts':
             datetime.now().strftime(SERIALIZED_DATETIME_FORMAT),
             'deleted_at': None,
             'parent_mailing': {
                 'mailing_type': "m",
                 'send_started': None,
                 'signup_form_id': None,
                 'mailing_id': 1024,
                 'plaintext': "Hello [% member:first_name %]!",
                 'recipient_count': 0,
                 'year': None,
                 'account_id': 100,
                 'month': None,
                 'disabled': False,
                 'parent_mailing_id': None,
                 'started_or_finished': None,
                 'name': "Sample Mailing",
                 'mailing_status': "c",
                 'plaintext_only': False,
                 'sender': "Test Sender",
                 'send_finished': None,
                 'send_at': None,
                 'reply_to': None,
                 'subject': "Parent Mailing",
                 'archived_ts': None,
                 'html_body': "<p>Hello [% member:first_name %]!</p>"
             }
         })
コード例 #2
0
ファイル: member_test.py プロジェクト: ptomblin/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.member = Member(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'member_id':
             1000,
             'email':
             u"*****@*****.**",
             'status':
             u"opt-out",
             'member_status_id':
             u"o",
             'change_type':
             u"u",
             'last_modified_at':
             datetime.now().strftime(SERIALIZED_DATETIME_FORMAT),
             'member_since':
             datetime.now().strftime(SERIALIZED_DATETIME_FORMAT),
             'deleted_at':
             None
         })
     self.member.account.fields._dict = {
         2000: {
             'shortcut_name': u"first_name"
         },
         2001: {
             'shortcut_name': u"last_name"
         }
     }
コード例 #3
0
ファイル: group_test.py プロジェクト: ptomblin/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.members = Group(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'member_group_id': 200,
             'group_name': u"My Group"
         }).members
コード例 #4
0
ファイル: member_test.py プロジェクト: ptomblin/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.mailings = Member(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'member_id': 1000,
             'email': u"*****@*****.**",
             'status': u"opt-out"
         }).mailings
コード例 #5
0
ファイル: group_test.py プロジェクト: ptomblin/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.group = Group(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'group_name': u"Test Group",
             'group_type': GroupType.RegularGroup,
             'deleted_at': None
         })
コード例 #6
0
ファイル: search_test.py プロジェクト: Nibblecomm/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.search = Search(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'search_id': 200,
             'deleted_at': None,
             'last_run_at':
             datetime.now().strftime(SERIALIZED_DATETIME_FORMAT)
         })
コード例 #7
0
ファイル: webhook_test.py プロジェクト: ptomblin/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.webhook = WebHook(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'webhook_id': 200,
             'url': u"http://example.com",
             'method': u"POST",
             'event': u"mailing_finish"
         })
コード例 #8
0
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.members = MemberImport(
         Account(account_id="100", public_key="xxx", private_key="yyy"),
         {
             'status': ImportStatus.Ok,
             'style': ImportStyle.AddAndUpdate,
             'import_started': datetime.now().strftime(SERIALIZED_DATETIME_FORMAT),
             'import_finished': datetime.now().strftime(SERIALIZED_DATETIME_FORMAT)
         }
     ).members
コード例 #9
0
ファイル: mailing_test.py プロジェクト: ptomblin/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.mailing = Mailing(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'mailing_id': 200,
             'delivery_ts':
             datetime.now().strftime(SERIALIZED_DATETIME_FORMAT),
             'clicked': None,
             'opened': None,
             'forwarded': None,
             'shared': None,
             'sent': datetime.now().strftime(SERIALIZED_DATETIME_FORMAT)
         })
コード例 #10
0
ファイル: automation_test.py プロジェクト: myemma/EmmaPython
 def setUp(self):
     """
     Set up tasks for our tests
     """
     Account.default_adapter = MockAdapter
     self.workflow = Workflow(
         Account(account_id="100", public_key="xxx", private_key="yyy"),
         {
             'workflow_id': '22048a49-9533-4014-ae03-2af3598ed9a7',
             'status': 'active',
             'name': 'Test',
             'created_at': datetime.now().strftime(SERIALIZED_DATETIME_ALT_FORMAT),
             'updated_at': datetime.now().strftime(SERIALIZED_DATETIME_ALT_FORMAT),
         }
     )
コード例 #11
0
ファイル: field_test.py プロジェクト: Nibblecomm/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.field = Field(
         Account(account_id="100", public_key="xxx", private_key="yyy"),
         {
             'field_id':200,
             'shortcut_name':"test_field",
             'display_name':"Test Field",
             'field_type':FieldType.TextArray,
             'widget_type':WidgetType.RadioButtonMenu,
             'column_order':3,
             'options':["A", "B", "C"],
             'deleted_at': None
         }
     )
コード例 #12
0
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.account = Account(account_id="100",
                            public_key="xxx",
                            private_key="yyy")
コード例 #13
0
ファイル: search_test.py プロジェクト: Nibblecomm/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.members = Search(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'search_id': 1024
         }).members
コード例 #14
0
ファイル: mailing_test.py プロジェクト: ptomblin/EmmaPython
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.messages = Mailing(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'mailing_id': 200
         }).messages
コード例 #15
0
 def setUp(self):
     Account.default_adapter = MockAdapter
     self.mailings = Trigger(
         Account(account_id="100", public_key="xxx", private_key="yyy"), {
             'trigger_id': 1024
         }).mailings
コード例 #16
0
# EMMA SCRIPT FOR OPTING OUT INVALID EMAILS FROM EMMA. PLEASE READ THE "README" FILE FOR DETAILS
# @author: Vladimir Martintsov
# @email: [email protected]

from emma import enumerations
from emma import exceptions as ex
from emma.model.account import Account
from pprint import pprint
from datetime import datetime, timedelta
import csv, sys, os, time

#YOUR AUTHENTICATION INFO HERE (Account ID, public key, private key)
emma_account = Account(1234, "abcd1234", "abcd1234")

#Total, erroneous, opted-out, and active emails count
total_emails_count = 0
invalid_emails_count = 0
already_opted_out_emails_count = 0
opted_out_emails_count = 0
active_emails_count = 0

current_time = time.strftime("%Y-%b-%d__%H_%M_%S", time.localtime())
output_csv_name = "Invalid_Emma_emails_" + current_time + ".csv"
three_months_period_date_check = datetime.now() - timedelta(days=90)

#Local email address sanity check for correctness before calling API
# all the other special characters will have to be verified through Emma


#TWO CONDITIONS:
# if there are commas and spaces present - email is invalid