Table.query method supposedly has a TimeFilter parameter, but no definition of TimeFilter object is provided in the documentation.
Anyone know how to create a TimeFilter object to supply to Table.query()?
time_filter - a TimeFilter object where either the start timeor start and end time are defined to limit the search results for a given time. The values in the timeFilter should be as UTC timestampes in milliseconds. No checking occurs to see if they are in the right format.
Solved! Go to Solution.
You can pass in a dict with this format:
{'time': '1510704000000,1514764800000'}
Here is an example you can use to construct this dict:
from datetime import datetime
import time
timerange = [datetime(2017, 11, 15), datetime(2018, 1, 1)]
starttime = int(time.mktime((timerange[0]).timetuple()) * 1000)
endtime = int(time.mktime((timerange[1]).timetuple()) * 1000)
time_filter = {'time' : "%s,%s" % (starttime, endtime)}
You can pass in a dict with this format:
{'time': '1510704000000,1514764800000'}
Here is an example you can use to construct this dict:
from datetime import datetime
import time
timerange = [datetime(2017, 11, 15), datetime(2018, 1, 1)]
starttime = int(time.mktime((timerange[0]).timetuple()) * 1000)
endtime = int(time.mktime((timerange[1]).timetuple()) * 1000)
time_filter = {'time' : "%s,%s" % (starttime, endtime)}
Thanks, Rohit!