Timeout while retrieving email responses via python SDK

Trying to get open events using the python code below:

getOpenEvent = FuelSDK.ET_OpenEvent()
getOpenEvent.auth_stub = stubObj
getOpenEvent.props = ["SendID","SubscriberKey","EventDate","EventType"]
getOpenEvent.search_filter = {'Property' : 'EventDate',
                              'SimpleOperator' : 'greaterThan',
                              'Value' : myDate.strftime("%Y-%m-%d %H:%M:%S")}
getResponse = getOpenEvent.get()
print(getResponse.status)
print(getResponse.code)
print(getResponse.message)
print(len(getResponse.results))

I get the following returned:

false
200
Error: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
0

Is there any way to increase the timeout time? Or is there any way to make my filter more specific to return only certain events? I tried filtering on other properties like ID but it still seems to timeout. Any ideas?

The documentation I was referencing:
https://code.exacttarget.com/apis-sdks/fuel-sdks/tracking/open-tracking.html

Answer

I had a similar issue awhile back retrieving different tracking events and was able to resolve it by creating a complex filter with more filtering criteria such as a SendID or ClientID (MID), along with the date filter. A complex filter can be 2 simple filters combined with an operator.

I created some example code but am unable to test at the moment, hopefully it gives you enough of an idea to drop into your project:

date_filter = {'Property' : 'EventDate', 'SimpleOperator' : 'greaterThan', 'Value' : myDate.strftime("%Y-%m-%d %H:%M:%S")}
mid_filter = {'Property' : 'Client.ID', 'SimpleOperator' : 'equals', 'Value' : '123456'}
getOpenEvent.search_filter = {'LeftOperand' : date_filter  , 'LogicalOperator': 'AND', 'RightOperand' : mid_filter}

(you will need to change the mid_filter value to the MID of your ET account.)

Here is a reference creating complex filters using the Python FuelSDK: https://github.com/ExactTarget/FuelSDK-Python/issues/31

Here is my original question which references the SOAP API: Retrieve NotSentEvent

Attribution
Source : Link , Question Author : Ian , Answer Author : Community

Leave a Comment