Reputation: 45
I am trying to iterate through a list of calls made from a certain date using Twilio's python library. However, whenever I call
client.calls.count()
I get an error 500 which appears to be a timeout:
twilio.TwilioRestException: HTTP ERROR 500: 20500: An internal server error has occurred
So I tried to get a count of calls for the time range I am interested in, as follows:
calls = client.calls.list(started_after=date(year, month, day))
Where year, month and day are ints. But this gets me an error:
TypeError: count() got an unexpected keyword argument 'started_after'
What's up? How can I get a count of calls from a certain date? I am trying to follow what is described here: Twilio Python helper library - How do you know how many pages list resource returned?
Upvotes: 0
Views: 221
Reputation: 64874
Sadly this is something that happens when your data grows too large - we can't return the count() fast enough and the query times out. We're working on a fix but it is a ways out still.
You may want to try using the Usage Record API for usage information like the number of calls, etc. You can filter the usage record data by arbitrary date times.
Otherwise, you can retrieve all of your results, following the next_page_uri
provided by Twilio (or the iterator in Python) and keep a count as you go. Sorry I can't give you a better answer :(
Upvotes: 1