2017-03-24 45 views
0

我試圖檢索到2017年1月1日之後完成的呼叫列表。基於我嘗試過的文檔:使用Python Rest API從Twilio檢索呼叫記錄

calls=client.calls.list(started_after=date(2017,1,1)) 
for call in calls: 
    print("Call to: {} call from {} duration {}".format(call.to,call.from_, call.duration)) 

我正在檢索通話記錄,但我所得到的只是當天的通話記錄。

回答

0

Twilio開發者傳道這裏。

我相信list of calls的排序順序是反向時間順序,所以你最先得到最近的呼叫。全部list resources from Twilio are paginated爲了檢索更多。默認頁面大小爲50.

您最多可以將pageSize最多變爲1000,以在一次API調用中獲取更多記錄。

calls=client.calls.list(started_after=date(2017,1,1), page_size=1000) 

或者,你可以使用Python helper library'siter method, to iterate over the list of calls,使所有的API調用,你需要獲取的所有數據。

calls=client.calls.iter(started_after=date(2017,1,1)) 

讓我知道是否有幫助。