Sarthak Sharma
Sarthak Sharma

Reputation: 121

Error with TwilioRestClient in Python 2.7

I recently installed Twilio module and I am using Python 2.7

Credentials.py -->

account_sid = "AXXXXXXXXXXXXXXXXXXXXXXXXXXXXx"

auth_token = "978XXXXXXXXXXXXXXXXXXXXXX"

my_phone = "+XXXXXXXXXXXX"

my_twilio = "+XXXXXXXXXXXX"

message.py ----->

from twilio.rest import TwilioRestClient

from credentials import account_sid, auth_token, my_phone, my_twilio

client = TwilioRestClient(account_sid, auth_token)

message = 'Hello Sarthak, How are you?'

final_message = client.messages.create(to=my_phone, from_=my_twilio, 
body=message)

When I try to run this, I am getting this error :-

enter image description here

Upvotes: 1

Views: 128

Answers (1)

WorkShoft
WorkShoft

Reputation: 440

From twilio.rest import Client

TwilioRestClient is deprecated. You have to import Client instead. Make sure you are using Python 3 too.

Upvotes: 2

Related Questions