Skip to main content
The First Step
October 24, 2019
Question

Python Call Log

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

    PhongVu
    Community Manager
    Community Manager
    October 24, 2019

    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.