Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TwilioRestClient removed [duplicate]

tClient= TwilioRestClient(sid, token)

This code throws exception:

twilio.base.obsolete.ObsoleteException: TwilioRestClient has been removed from this version of the library. Please refer to current documentation for guidance.

Can't seem to find a reference to this anywhere, this worked a few days ago!

Using python 3.7 and VS2017

like image 452
RobD Avatar asked Aug 16 '18 14:08

RobD


2 Answers

use

from twilio.rest import Client

tClient= Client(sid, token)

as TwilioRestClient was deprecated.

like image 61
Mwangi Kabiru Avatar answered Sep 29 '22 14:09

Mwangi Kabiru


TwilioRestClient was depreciated remove the words 'TwilioRestClient' and replace it as below:

from twilio.rest import Client

account = "Account number for Twilio"
token = "Token for Twilio Account"

client = Client(account, token)

message = client.messages.create(to="+ReceiverPhone#", from_="+TwilioPhone#",
                             body="Text message you are sending to receiver")
#print response back from Twilio
print message
like image 24
Jay Newens Avatar answered Sep 29 '22 12:09

Jay Newens