Reputation: 121
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 :-
Upvotes: 1
Views: 128
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