I am attempting to use the Python SDK to retrieve/query Trips for a particular device from one date/time to another that I can see from a report that I pulled from our environment.
My understanding is that the database date/time's are in UTC, so I am converting from out local time to UTC for simplicity sake. I know that I am pulling the correct device information as well. "trips.json" is what I receive back from this particular call, and it returns trips that started nowhere near the date entered. Can I get some help to get particular trips where the start (or end) date/times are within a certain bounds similar to what I have in the attached example report?
import mygeotab.dates
import datetime, mygeotab, pytz
cst_tz = pytz.timezone('US/Central');
startDateTime_cst = cst_tz.localize(datetime.datetime(2024, 9, 3, 10, 34, 1));
startDateTime_utc = startDateTime_cst.astimezone(datetime.UTC);
endDateTime_cst = cst_tz.localize(datetime.datetime(2024, 9, 3, 11, 0, 0));
endDateTime_utc = startDateTime_cst.astimezone(datetime.UTC);
client = mygeotab.API(username='{username}', password='{password}', database='{db}');
client.authenticate();
device = client.get('Device', name='-')[0];
trips = client.get('Trip', FromDate=mygeotab.dates.format_iso_datetime(startDateTime_utc), ToDate=mygeotab.dates.format_iso_datetime(endDateTime_utc), IncludeOverlappedTrips=True, device=device);
print(trips);