9
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

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
RobD
  • 435
  • 4
  • 11
  • 21

3 Answers3

5

use

from twilio.rest import Client

tClient= Client(sid, token)

as TwilioRestClient was deprecated.

Mwangi Kabiru
  • 423
  • 2
  • 10
4

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
Opcero
  • 3
  • 3
Jay Newens
  • 41
  • 3
1

Must be working.

from twilio.rest import Client
# Your Account SID from twilio.com/console
account_sid = "asfdasdfasdfasdfsadfasdfsadfa"
# Your Auth Token from twilio.com/console
auth_token  = "asfdsadfasdfasdfasdfasfas"

client = Client(account_sid, auth_token)

message = client.messages.create(
to="+asdfasdfasfd",
from_="+asfdsafdsafsaf",
body="hello mister x")

print(message.sid)

Here is the real link

https://www.twilio.com/docs/libraries/python

Hadisur Rahman
  • 784
  • 6
  • 13