3👍
✅
Updated with the solution:
version twilio==6.0.0 (current one ) has different directory structure,so it effect importing structure
Below is the updated importing structure ..
from django.conf import settings
import twilio
import twilio.rest
from twilio.rest import Client
def send_twilio_message(to_number, body):
client = Client(settings.TWILIO_ACCOUNT_SID, settings.TWILIO_AUTH_TOKEN)
return client.api.account.messages.create(
body=body,
to=to_number,
from_=settings.PHONE_NUMBER
)
2👍
The tutorial you are following was written for an older version of the twilio sdk than 6.0.
You could try to look for a newer tutorial to follow, or you could try to adjust the tutorial. The migration guide might help with this.
You final option is to install an older, unsupported version of the twilio library that works with the tutorial, e.g.
pip install twilio==5.7
Source:stackexchange.com