本文整理汇总了Python中twilio.twiml.voice_response.VoiceResponse.to_xml方法的典型用法代码示例。如果您正苦于以下问题:Python VoiceResponse.to_xml方法的具体用法?Python VoiceResponse.to_xml怎么用?Python VoiceResponse.to_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twilio.twiml.voice_response.VoiceResponse
的用法示例。
在下文中一共展示了VoiceResponse.to_xml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: example
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import to_xml [as 别名]
def example():
"""
Some example usage of different twilio resources.
"""
client = Client(ACCOUNT_SID, AUTH_TOKEN)
# Get all messages
all_messages = client.messages.list()
print('There are {} messages in your account.'.format(len(all_messages)))
# Get only last 10 messages...
some_messages = client.messages.list(limit=10)
print('Here are the last 10 messages in your account:')
for m in some_messages:
print(m)
# Get messages in smaller pages...
all_messages = client.messages.list(page_size=10)
print('There are {} messages in your account.'.format(len(all_messages)))
print('Sending a message...')
new_message = client.messages.create(to='XXXX', from_='YYYY', body='Twilio rocks!')
print('Making a call...')
new_call = client.calls.create(to='XXXX', from_='YYYY', method='GET')
print('Serving TwiML')
twiml_response = VoiceResponse()
twiml_response.say('Hello!')
twiml_response.hangup()
twiml_xml = twiml_response.to_xml()
print('Generated twiml: {}'.format(twiml_xml))