Search code examples
pythonibm-cloudtwilioraspberry-pi3iot

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


I'm doing a Internet of Thing(IoT) project, and I follow a sample from below sources. But I fail at last step when I push to start this app. 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.

ex. There are two error, if you can not see clearly. 1. Err: You must give at least one requirement to install (see "pip help install")

2. Err: Traceback (most recent call last): Err: File "server.py". line12, in Err: twilioClient = TwilioRestClient(twilio Account, twilio Token) ERR: File "/home/vcap/deps/0/python/lib/python2.7/site-packages/twilio/base/obsolete.py", line 20. in new_func Err: .format(func.name) Err: twilio.base.obsolete.obsoleteException: TwilioRestClient has been removed from this version of the library. Please refer to current documentation for guidance.


Solution

  • For: 1. Err: You must give at least one requirement to install (see "pip help install")

    You need to run this on the Raspberry PI:

    sudo pip install twilio

    If you don't have pip installed then run:

    sudo apt-get install python3-pip

    and then again: sudo pip install twilio

    for 2. Err: Traceback (most recent call last): Err: File "server.py". line12

    Basically the twilio client definition needs to be similar to:

    from twilio.rest import Client

    client = Client(account_sid, auth_token)

    so from the trace, line 12 in server.py should be similar to

    from twilio.rest import Client //this should be also changed

    twilioClient = Client(account_sid, auth_token) //this is line 12