gpt4 book ai didi

Python-twilio api 错误?

转载 作者:行者123 更新时间:2023-11-28 23:04:27 25 4
gpt4 key购买 nike

我正在使用 twilio-python 并且正在学习本教程: http://readthedocs.org/docs/twilio-python/en/latest/usage/twiml.html?highlight=nest

但是当我尝试这个时:

from twilio import twiml

r = twiml.Response()
r.say("hello")
with r.gather(finishOnKey=4) as g:
g.say("world")
print str(r)

但是我明白了:

AttributeError: __exit__

有什么想法吗?

最佳答案

它们似乎与 with 语句并不兼容。试试这个:

from twilio import twiml

r = twiml.Response()
r.say("hello")
g = r.gather(finishOnKey=4)
g.say("world")
print str(r)

这是我得到的:

>>> from twilio import twiml
>>>
>>> r = twiml.Response()
>>> r.say("hello")
<twilio.twiml.Say object at 0x1098d05d0>
>>> g = r.gather(finishOnKey=4)
>>> g.say("world")
<twilio.twiml.Say object at 0x1098d0950>
>>> print str(r)
<?xml version="1.0" encoding="UTF-8"?><Response><Say>hello</Say><Gather finishOnKey="4"><Say>world</Say></Gather></Response>

关于Python-twilio api 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7591009/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com