当前位置: 首页>>代码示例>>Python>>正文


Python VoiceResponse.to_xml方法代码示例

本文整理汇总了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))
开发者ID:kanyapnp,项目名称:twilio-python,代码行数:34,代码来源:basic_usage.py


注:本文中的twilio.twiml.voice_response.VoiceResponse.to_xml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。