本文整理汇总了Python中twilio.twiml.Response.append方法的典型用法代码示例。如果您正苦于以下问题:Python Response.append方法的具体用法?Python Response.append怎么用?Python Response.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twilio.twiml.Response
的用法示例。
在下文中一共展示了Response.append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testToFromAction
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testToFromAction(self):
""" Test the to, from, and status callback"""
r = Response()
r.append(twiml.Sms("Hello, World", to=1231231234, sender=3453453456,
statusCallback="example.com?id=34&action=hey"))
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Sms from="3453453456" statusCallback="example.com?id=34&action=hey" to="1231231234">Hello, World</Sms></Response>')
示例2: testAddNumber
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testAddNumber(self):
"""add a number to a dial"""
r = Response()
d = twiml.Dial()
d.append(twiml.Number("1231231234"))
r.append(d)
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Dial><Number>1231231234</Number></Dial></Response>')
示例3: testAddConference
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testAddConference(self):
""" add a conference to a dial"""
r = Response()
d = twiml.Dial()
d.append(twiml.Conference("My Room"))
r.append(d)
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Dial><Conference>My Room</Conference></Dial></Response>')
示例4: testAddNumberStatusCallbackEvent
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testAddNumberStatusCallbackEvent(self):
""" add a number to a dial with status callback events"""
r = Response()
d = twiml.Dial()
d.append(twiml.Number("1231231234", statusCallback="http://example.com", statusCallbackEvent="initiated completed"))
r.append(d)
r = self.strip(r)
assert_equal(r, '<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Number statusCallback="http://example.com" statusCallbackEvent="initiated completed">1231231234</Number></Dial></Response>')
示例5: testNestedSayPlayPause
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testNestedSayPlayPause(self):
""" a gather with a say, play, and pause"""
r = Response()
g = twiml.Gather()
g.append(twiml.Say("Hey"))
g.append(twiml.Play("hey.mp3"))
g.append(twiml.Pause())
r.append(g)
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Gather><Say>Hey</Say><Play>hey.mp3</Play><Pause /></Gather></Response>')
示例6: testActionMethod
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testActionMethod(self):
""" Test the action and method parameters on Sms"""
r = Response()
r.append(twiml.Sms("Hello", method="POST", action="example.com?id=34&action=hey"))
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Sms action="example.com?id=34&action=hey" method="POST">Hello</Sms></Response>')
示例7: testDial
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testDial(self):
""" should redirect the call"""
r = Response()
r.append(twiml.Dial("1231231234"))
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Dial>1231231234</Dial></Response>')
示例8: testBody
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testBody(self):
"""Test hello world"""
r = Response()
r.append(twiml.Sms("Hello, World"))
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Sms>Hello, World</Sms></Response>')
示例9: testRedirectMethod
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testRedirectMethod(self):
r = Response()
r.append(twiml.Redirect(url="example.com", method="POST"))
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="UTF-8"?><Response><Redirect method="POST">example.com</Redirect></Response>')
示例10: testSayLoopGreatBritian
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testSayLoopGreatBritian(self):
"""should say have a woman say hello monkey and loop 3 times"""
r = Response()
r.append(twiml.Say("Hello Monkey", language="en-gb"))
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="UTF-8"?><Response><Say language="en-gb">Hello Monkey</Say></Response>')
示例11: testPlayDigits
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testPlayDigits(self):
""" should play digits """
r = Response()
r.append(twiml.Play(digits='w123'))
r = self.strip(r)
self.assertEqual(r, '<?xml version="1.0" encoding="UTF-8"?><Response><Play digits="w123" /></Response>')
示例12: testEmptySay
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testEmptySay(self):
"""should be a say with no text"""
r = Response()
r.append(twiml.Say(""))
self.assertEquals(self.strip(r), '<?xml version="1.0" encoding="utf-8"?><Response><Say /></Response>')
示例13: testEmpty
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testEmpty(self):
""" a gather with nothing inside"""
r = Response()
r.append(twiml.Gather())
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Gather /></Response>')
示例14: testRecordTranscribeCallback
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testRecordTranscribeCallback(self):
"""should record with a transcribe and transcribeCallback"""
r = Response()
r.append(twiml.Record(transcribeCallback="example.com"))
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Record transcribeCallback="example.com" /></Response>')
示例15: testRedirectEmpty
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import append [as 别名]
def testRedirectEmpty(self):
r = Response()
r.append(twiml.Redirect())
r = self.strip(r)
self.assertEquals(r, '<?xml version="1.0" encoding="utf-8"?><Response><Redirect /></Response>')