Question

Python Call Log

  • 24 October 2019
  • 1 reply
  • 473 views

Hi, I have a working python script that pulls the call log from RC which runs every 15 mins and sends it to a database however the problem is that it re-downloads the entire call log every time.


I need the script to check for only new records, how do I do this?


1 reply

Userlevel 1

You can use the "dateFrom" and "dateTo" to keep track of the logs (within the specified date/time period) you have downloaded.

now = time.time()
less15Mins = now - (60 * 15)

dateFrom = datetime.utcfromtimestamp(less15Mins).strftime('%Y-%m-%dT%H:%M:%S.000Z'
params = {
    'dateFrom': dateFrom,
    'perPage': 1000
}

Every time you read 15 mins backward from the current time.

Reply