python - 使用 raspberry-pi3 和 Bluemix 的 IoT 项目。错误: TwilioRestClient has been removed from this version of the library

标签 python ibm-cloud twilio raspberry-pi3 iot

我正在做一个物联网 (IoT) 项目,我遵循以下来源的示例。但是当我插入启动这个应用程序时,我在最后一步失败了。 https://www.ibm.com/blogs/bluemix/2015/04/tutorial-using-a-raspberry-pi-python-iot-twilio-bluemix/

1. I am using 'cf push to start the app', it works until crash. 2. I am using 'cf logs python-iot-hackathon2 --recent' to see logs, and there are two errors

3. There is a python code that given from tutorial source, i think i should edit the code from line7~12, but I do not know how. If there is another problem, please teach me how to do it. Thanks.

例如。有两个错误,如果看不清楚的话。 1. 错误:您必须至少给出一项安装要求(请参阅“pip help install”)

2. 错误:回溯(最近一次调用最后一次): 错误:文件“server.py”。第 12 行,在 错误:twilioClient = TwilioRestClient(twilio 帐户,twilio token ) 错误:文件“/home/vcap/deps/0/python/lib/python2.7/site-packages/twilio/base/obsolete.py”,第 20 行。在 new_func 中 错误:.format(func.名称) 错误:twilio.base.obsolete.obsoleteException: TwilioRestClient 已从此版本的库中删除。请参阅当前文档以获取指导。

最佳答案

针对:1. 错误:您必须至少给出一项安装要求(请参阅“pip help install”)

您需要在 Raspberry PI 上运行它:

sudo pip 安装 twilio

如果您没有安装 pip,请运行:

sudo apt-get install python3-pip

然后再次:sudo pip install twilio

对于 2. 错误:回溯(最近一次调用最后一次):错误:文件“server.py”。第12行

基本上,twilio 客户端定义需要类似于:

从 twilio.rest 导入客户端

客户端=客户端(account_sid,auth_token)

因此从跟踪来看,server.py 中的第 12 行应该类似于

from twilio.rest import Client//这也应该改变

twilioClient = Client(account_sid, auth_token)//这是第 12 行

关于python - 使用 raspberry-pi3 和 Bluemix 的 IoT 项目。错误: TwilioRestClient has been removed from this version of the library,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47300110/

相关文章:

node.js - 如何在 Node.js 中调用需要用户名和密码的 API

node.js - twilio 向调用者说些什么(node.js)

Python:对字符串列表进行排序,以便它们出现在另一个字符串中

python - 尝试将输入到条目小部件中的文本存储到变量中

node.js - 我可以在 bluemix 上为我的应用程序保留另一个端口吗?

ios - 如何通过 Twilio Functions 向多个号码发送短信?

ios - 具有媒体和自定义属性的 Twilio 可编程聊天消息

python - 使用 ThreadPoolExecutor 时记录线程

python - 如何在开发时检查django-paypal的订阅

android - 无法在 Bluemix 中找到 App key 和 App Secret。 App GUID 可用,而不是那些