This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 192
/
sample_bounceevent.py
65 lines (58 loc) · 3.18 KB
/
sample_bounceevent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import ET_Client
try:
debug = False
stubObj = ET_Client.ET_Client(False, debug)
## Modify the date below to reduce the number of results returned from the request
## Setting this too far in the past could result in a very large response size
retrieveDate = '2011-01-15T13:00:00.000'
print ('>>> Retrieve Filtered BounceEvents with GetMoreResults')
getBounceEvent = ET_Client.ET_BounceEvent()
getBounceEvent.auth_stub = stubObj
getBounceEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
getBounceEvent.search_filter = {'Property' : 'EventDate', 'SimpleOperator' : 'greaterThan', 'DateValue' : retrieveDate}
getResponse = getBounceEvent.get()
print ('Retrieve Status: ' + str(getResponse.status) )
print ('Code: ' + str(getResponse.code) )
print ('Message: ' + str(getResponse.message) )
print ('MoreResults: ' + str(getResponse.more_results) )
print ('RequestID: ' + str(getResponse.request_id) )
print ('Results Length: ' + str(len(getResponse.results)) )
print ('Results: ' + str(getResponse.results) )
while getResponse.more_results:
print ('>>> Continue Retrieve Filtered BounceEvents with GetMoreResults')
getResponse = getBounceEvent.getMoreResults()
print ('Retrieve Status: ' + str(getResponse.status))
print ('Code: ' + str(getResponse.code))
print ('Message: ' + str(getResponse.message))
print ('MoreResults: ' + str(getResponse.more_results))
print ('RequestID: ' + str(getResponse.request_id))
print ('Results Length: ' + str(len(getResponse.results)))
# The following request could potentially bring back large amounts of data if run against a production account
'''
print '>>> Retrieve All BounceEvents with GetMoreResults'
getBounceEvent = ET_BounceEvent.new()
getBounceEvent.auth_stub = stubObj
getBounceEvent.props = ["SendID","SubscriberKey","EventDate","Client.ID","EventType","BatchID","TriggeredSendDefinitionObjectID","PartnerKey"]
getResponse = getBounceEvent.get
print 'Retrieve Status: ' + str(getResponse.status)
print 'Code: ' + str(getResponse.code)
print 'Message: ' + str(getResponse.message)
print 'MoreResults: ' + str(getResponse.more_results)
print 'RequestID: ' + str(getResponse.request_id)
print 'Results Length: ' + str(len(getResponse.results))
# Since this could potentially return a large number of results, we do not want to print the results
#print 'Results: ' + str(getResponse.results)
while getResponse.moreResults do
print '>>> Continue Retrieve All BounceEvents with GetMoreResults'
getResponse = getBounceEvent.getMoreResults
print 'Retrieve Status: ' + str(getResponse.status)
print 'Code: ' + str(getResponse.code)
print 'Message: ' + str(getResponse.message)
print 'MoreResults: ' + str(getResponse.more_results)
print 'RequestID: ' + str(getResponse.request_id)
print 'Results Length: ' + str(len(getResponse.results))
end
'''
except Exception as e:
print ('Caught exception: ' + e.message)
print (e)