How to use the createsend.segment.Segment function in createsend

To help you get started, we’ve selected a few createsend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github campaignmonitor / createsend-python / test / test_segment.py View on Github external
def setUp(self):
        self.segment_id = "98y2e98y289dh89h938389"
        self.segment = Segment(
            {'api_key': '123123123123123123123'}, self.segment_id)
github campaignmonitor / createsend-python / test / test_segment.py View on Github external
def test_create(self):
        list_id = "2983492834987394879837498"
        rulegroups = [{"Rules": [{"RuleType": "EmailAddress", "Clause": "CONTAINS example.com"},  {
            "RuleType": "Name", "Clause": "EQUALS subscriber"}]}]
        s = Segment()
        s.stub_request("segments/%s.json" % list_id, "create_segment.json", None,
                       "{\"RuleGroups\": [{\"Rules\": [{\"Clause\": \"CONTAINS example.com\", \"RuleType\": \"EmailAddress\"}, {\"Clause\": \"EQUALS subscriber\", \"RuleType\": \"Name\"}]}], \"Title\": \"new segment title\"}")
        segment_id = s.create(list_id, "new segment title", rulegroups)
        self.assertEquals(segment_id, "0246c2aea610a3545d9780bf6ab890061234")
        self.assertEquals(s.segment_id, "0246c2aea610a3545d9780bf6ab890061234")