-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
647 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ cover | |
htmlcov | ||
.tox | ||
lib/createsend.egg-info | ||
.rake_tasks~ | ||
.rake_tasks~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from __future__ import absolute_import | ||
|
||
from createsend.createsend import CreateSendBase | ||
from createsend.utils import json_to_py | ||
|
||
|
||
class Journey(CreateSendBase): | ||
"""Represents a journey and associated functionality""" | ||
|
||
def __init__(self, auth=None, journey_id=None): | ||
self.journey_id = journey_id | ||
super(Journey, self).__init__(auth) | ||
|
||
def summary(self): | ||
"""Gets the summary of the journey""" | ||
response = self._get("/journeys/%s.json" % self.journey_id) | ||
return json_to_py(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from __future__ import absolute_import | ||
|
||
from createsend.createsend import CreateSendBase | ||
from createsend.utils import json_to_py | ||
|
||
|
||
class JourneyEmail(CreateSendBase): | ||
"""Represents a journey and associated functionality""" | ||
|
||
def __init__(self, auth=None, journey_email_id=None): | ||
self.journey_email_id = journey_email_id | ||
super(JourneyEmail, self).__init__(auth) | ||
|
||
def bounces(self, date=None, page=None, page_size=None, order_direction=None): | ||
"""Retrieves the bounces for this journey email.""" | ||
return self.get_journey_email_response(date, page, page_size, order_direction, "bounces") | ||
|
||
def clicks(self, date=None, page=None, page_size=None, order_direction=None): | ||
"""Retrieves the clicks for this journey email.""" | ||
return self.get_journey_email_response(date, page, page_size, order_direction, "clicks") | ||
|
||
def opens(self, date=None, page=None, page_size=None, order_direction=None): | ||
"""Retrieves the opens for this journey email.""" | ||
return self.get_journey_email_response(date, page, page_size, order_direction, "opens") | ||
|
||
def recipients(self, date=None, page=None, page_size=None, order_direction=None): | ||
"""Retrieves the recipients for this journey email.""" | ||
return self.get_journey_email_response(date, page, page_size, order_direction, "recipients") | ||
|
||
def unsubscribes(self, date=None, page=None, page_size=None, order_direction=None): | ||
"""Retrieves the unsubscribes for this journey email.""" | ||
return self.get_journey_email_response(date, page, page_size, order_direction, "unsubscribes") | ||
|
||
def get_journey_email_response(self, date, page, page_size, order_direction, uri): | ||
"""Retrieves information for the journey email - based on theuri""" | ||
params = {} | ||
if date is not None: | ||
params["date"] = date | ||
if page is not None: | ||
params["page"] = page | ||
if page_size is not None: | ||
params["pagesize"] = page_size | ||
if order_direction is not None: | ||
params["orderdirection"] = order_direction | ||
response = self._get(self.uri_for(uri), params=params) | ||
return json_to_py(response) | ||
|
||
def uri_for(self, action): | ||
return "/journeys/email/%s/%s.json" % (self.journey_email_id, action) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"ListID": "a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", | ||
"JourneyID": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", | ||
"Name": "Journey 1", | ||
"Status": "Active" | ||
}, | ||
{ | ||
"ListID": "a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", | ||
"JourneyID": "b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", | ||
"Name": "New journey", | ||
"Status": "Active" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"Results": [ | ||
{ | ||
"EmailAddress": "asdf@softbouncemyemail.comX", | ||
"BounceType": "Soft", | ||
"Date": "2019-08-20 14:24:00", | ||
"Reason": "Soft Bounce - Dns Failure" | ||
}, | ||
{ | ||
"EmailAddress": "asdf@hardbouncemyemail.com", | ||
"BounceType": "Hard", | ||
"Date": "2019-08-21 04:26:00", | ||
"Reason": "Hard Bounce" | ||
} | ||
], | ||
"ResultsOrderedBy": "Date", | ||
"OrderDirection": "ASC", | ||
"PageNumber": 1, | ||
"PageSize": 1000, | ||
"RecordsOnThisPage": 2, | ||
"TotalNumberOfRecords": 2, | ||
"NumberOfPages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"Results": [ | ||
{ | ||
"EmailAddress": "asdf@hardbouncemyemail.com", | ||
"BounceType": "Hard", | ||
"Date": "2019-08-21 04:26:00", | ||
"Reason": "Hard Bounce" | ||
}, | ||
{ | ||
"EmailAddress": "asdf@softbouncemyemail.comX", | ||
"BounceType": "Soft", | ||
"Date": "2019-08-20 14:24:00", | ||
"Reason": "Soft Bounce - Dns Failure" | ||
} | ||
], | ||
"ResultsOrderedBy": "Date", | ||
"OrderDirection": "DESC", | ||
"PageNumber": 1, | ||
"PageSize": 10, | ||
"RecordsOnThisPage": 2, | ||
"TotalNumberOfRecords": 2, | ||
"NumberOfPages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"Results": [ | ||
{ | ||
"EmailAddress": "asdf@example.com", | ||
"Date": "2019-08-19 10:23:00", | ||
"URL": "http://mail.google.com/mail/?hl=en&tab=wm", | ||
"IPAddress": "198.148.196.144", | ||
"Latitude": -33.8591, | ||
"Longitude": 151.200195, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
}, | ||
{ | ||
"EmailAddress": "asdf+2@example.com", | ||
"Date": "2019-08-19 10:24:00", | ||
"URL": "https://example.com", | ||
"IPAddress": "198.148.196.144", | ||
"Latitude": -33.8591, | ||
"Longitude": 151.200195, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
} | ||
], | ||
"ResultsOrderedBy": "Date", | ||
"OrderDirection": "ASC", | ||
"PageNumber": 1, | ||
"PageSize": 1000, | ||
"RecordsOnThisPage": 2, | ||
"TotalNumberOfRecords": 2, | ||
"NumberOfPages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"Results": [ | ||
{ | ||
"EmailAddress": "asdf+2@example.com", | ||
"Date": "2019-08-19 10:24:00", | ||
"URL": "https://example.com", | ||
"IPAddress": "198.148.196.144", | ||
"Latitude": -33.8591, | ||
"Longitude": 151.200195, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
}, | ||
{ | ||
"EmailAddress": "asdf@example.com", | ||
"Date": "2019-08-19 10:23:00", | ||
"URL": "http://mail.google.com/mail/?hl=en&tab=wm", | ||
"IPAddress": "198.148.196.144", | ||
"Latitude": -33.8591, | ||
"Longitude": 151.200195, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
} | ||
], | ||
"ResultsOrderedBy": "Date", | ||
"OrderDirection": "DESC", | ||
"PageNumber": 1, | ||
"PageSize": 10, | ||
"RecordsOnThisPage": 2, | ||
"TotalNumberOfRecords": 2, | ||
"NumberOfPages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"Results": [ | ||
{ | ||
"EmailAddress": "asdf@example.com", | ||
"Date": "2019-08-19 10:23:00", | ||
"IPAddress": "198.148.196.144", | ||
"Latitude": -33.8591, | ||
"Longitude": 151.200195, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
}, | ||
{ | ||
"EmailAddress": "asdf+2@example.com", | ||
"Date": "2019-08-19 10:24:00", | ||
"IPAddress": "198.148.196.144", | ||
"Latitude": -33.8591, | ||
"Longitude": 151.200195, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
} | ||
], | ||
"ResultsOrderedBy": "Date", | ||
"OrderDirection": "ASC", | ||
"PageNumber": 1, | ||
"PageSize": 1000, | ||
"RecordsOnThisPage": 2, | ||
"TotalNumberOfRecords": 2, | ||
"NumberOfPages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"Results": [ | ||
{ | ||
"EmailAddress": "asdf+2@example.com", | ||
"Date": "2019-08-19 10:24:00", | ||
"IPAddress": "198.148.196.144", | ||
"Latitude": -33.8591, | ||
"Longitude": 151.200195, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
}, | ||
{ | ||
"EmailAddress": "asdf@example.com", | ||
"Date": "2019-08-19 10:23:00", | ||
"IPAddress": "198.148.196.144", | ||
"Latitude": -33.8591, | ||
"Longitude": 151.200195, | ||
"City": "Sydney", | ||
"Region": "New South Wales", | ||
"CountryCode": "AU", | ||
"CountryName": "Australia" | ||
} | ||
], | ||
"ResultsOrderedBy": "Date", | ||
"OrderDirection": "DESC", | ||
"PageNumber": 1, | ||
"PageSize": 10, | ||
"RecordsOnThisPage": 2, | ||
"TotalNumberOfRecords": 2, | ||
"NumberOfPages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"Results": [ | ||
{ | ||
"EmailAddress": "asdf@example.com", | ||
"SentDate": "2019-08-19 10:23:00" | ||
}, | ||
{ | ||
"EmailAddress": "asdf+2@example.com", | ||
"SentDate": "2019-08-19 10:23:00" | ||
}, | ||
{ | ||
"EmailAddress": "asdf@softbouncemyemail.comX", | ||
"SentDate": "2019-08-20 14:24:00" | ||
}, | ||
{ | ||
"EmailAddress": "asdf@hardbouncemyemail.com", | ||
"SentDate": "2019-08-21 04:26:00" | ||
} | ||
], | ||
"ResultsOrderedBy": "SentDate", | ||
"OrderDirection": "ASC", | ||
"PageNumber": 1, | ||
"PageSize": 1000, | ||
"RecordsOnThisPage": 4, | ||
"TotalNumberOfRecords": 4, | ||
"NumberOfPages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"Results": [ | ||
{ | ||
"EmailAddress": "asdf@hardbouncemyemail.com", | ||
"SentDate": "2019-08-21 04:26:00" | ||
}, | ||
{ | ||
"EmailAddress": "asdf@softbouncemyemail.comX", | ||
"SentDate": "2019-08-20 14:24:00" | ||
}, | ||
{ | ||
"EmailAddress": "asdf+2@example.com", | ||
"SentDate": "2019-08-19 10:23:00" | ||
}, | ||
{ | ||
"EmailAddress": "asdf@example.com", | ||
"SentDate": "2019-08-19 10:23:00" | ||
} | ||
], | ||
"ResultsOrderedBy": "SentDate", | ||
"OrderDirection": "DESC", | ||
"PageNumber": 1, | ||
"PageSize": 10, | ||
"RecordsOnThisPage": 4, | ||
"TotalNumberOfRecords": 4, | ||
"NumberOfPages": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"Results": [ | ||
{ | ||
"EmailAddress": "asdf@example.com", | ||
"Date": "2019-08-19 10:24:00", | ||
"IPAddress": "198.148.196.144" | ||
} | ||
], | ||
"ResultsOrderedBy": "Date", | ||
"OrderDirection": "ASC", | ||
"PageNumber": 1, | ||
"PageSize": 1000, | ||
"RecordsOnThisPage": 1, | ||
"TotalNumberOfRecords": 1, | ||
"NumberOfPages": 1 | ||
} |
Oops, something went wrong.