2017-01-04 19 views
1

我在Twilio中使用python製作錄音。只是想知道如何訪問我製作的最新/最新的錄音?乾杯!如何在Twilio中獲得最新的錄音?

製作錄音:在訪問錄音

resp = twilio.twiml.Response() 
resp.say("Please record your message after the beep") 
resp.record(maxLength="10", action="/handle-recording") 

的示例代碼,我怎麼會最新的驗證碼呢?謝謝!

# Download the Python helper library from twilio.com/docs/python/install 
from twilio.rest import TwilioRestClient 

# Your Account Sid and Auth Token from twilio.com/user/account 
account_sid = "AC30bd8bdca7572344721eb96c15a5c0c7" 
auth_token = "your_auth_token" 
client = TwilioRestClient(account_sid, auth_token) 

# A list of recording objects with the properties described above 
recordings = client.recordings.list() 
+0

而在有人發表評論之前,沒有那不是我的API密鑰。 –

回答

1

recordings[-1]應該讓你在錄音的最後一個項目,這應該是最新的記錄,因爲記錄被附加到列表中。確保recordings不是空的,否則你會得到一個IndexError

+0

如何獲取該文件的網址? –

+1

重新編碼的實例資源具有您可以訪問的URI。請參閱Twilio的以下文檔:https://www.twilio.com/docs/api/rest/recording#instance –