question

Arron Voce avatar image
Arron Voce asked ·

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?

call logpython
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

· Write an Answer
Phong Vu avatar image
Phong Vu answered ·

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.

Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.