IoT project with raspberry-pi3 and Bluemix. Error : TwilioRestClient has been removed from this version of the library

IoT project with raspberry-pi3 and Bluemix. Error : TwilioRestClient has been removed from this version of the library

我正在做一个物联网 (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 令牌) 错误:文件“/home/vcap/deps/0/python/lib/python2.7/site-packages/twilio/base/obsolete.py”,第 20 行。在 new_func 中 错误:.format(func.name) 错误:twilio.base.obsolete.obsoleteException: TwilioRestClient 已从此版本的库中删除。请参阅当前文档以获取指导。

对于:1.错误:您必须至少提供一项安装要求(参见"pip help install")

您需要 运行 在 Raspberry PI:

sudo pip install twilio

如果你没有安装 pip 那么 运行:

sudo apt-get install python3-pip

然后再次:sudo pip install twilio

for 2. Err: Traceback (最近调用 last): Err: 文件 "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 行