How to easily access SubscriberID from BounceEvent
As described in the Salesforce documentation ( https://help.salesforce.com/articleView?id=mc_as_bounces.htm&type=5 ), Bounce event contains those following info : "ClientID","SendID","SubscriberKey","SubscriberID","ListID","EventDate","EventType","BounceCategory","SMTPCode","BounceReason","BatchID","TriggeredSendExternalKey".
I want to get a dict with those columns, but when I specify columns I want to access in the properties, SubscriberID and ListID are not directectly accessible.
getBounceEvent.props = ["ClientID","SendID","SubscriberKey","SubscriberID","ListID","EventDate","EventType","BounceCategory","SMTPCode","BounceReason","BatchID","TriggeredSendExternalKey"]
results to :
Message: Error: The Request Property(s) SubscriberID,ListID do not match with the fields of BounceEvent retrieve
I reached my goal by calling each time a function that finds the SubscriberID with the SubscriberKey : SubscriberId = get_subscriber_id_with_key(SubscriberKey) :
def get_subscriber_id_with_key(SubscriberKey):
import ET_Client
try:
debug = False
stubObj = ET_Client.ET_Client(False, debug)
getSub = ET_Client.ET_Subscriber()
getSub.auth_stub = stubObj
getSub.props = ["SubscriberKey", "Subscriber.ID"]
getSub.search_filter = {'Property' : 'SubscriberKey','SimpleOperator' : 'equals','Value' : SubscriberKey}
getResponse = getSub.get()
dict = getResponse.results
return dict[0][1]
except Exception as e:
print('Caught exception: ' + str(e.message))
print(e)
But it takes a way too much time...
Is there a best way to do it ?