Reputation: 19
I searched for similar issues but couldn't find a satisfying answer. Here's the python snippet that I am using to send messages from my Twilio verified number to my registered mobile number:
account_sid = ['AC02ba1e07c83130f76679f2f334160fba']
auth_token = ['*******************************']
client = Client(account_sid,auth_token)
message = client.messages \
.create(
body=sent,
from_='my_twilio_mobile_number',
to='my_reg_mobile_number'
)
print(message.sid)
Upon executing, I get the following error:
Traceback (most recent call last):
File "/Users/ameeteshsharma/Documents/covax/avail.py", line 59, in <module>
message = client.messages \
File "/usr/local/lib/python3.9/site-packages/twilio/rest/api/v2010/account/message/__init__.py", line 88, in create
payload = self._version.create(method='POST', uri=self._uri, data=data, )
File "/usr/local/lib/python3.9/site-packages/twilio/base/version.py", line 205, in create
raise self.exception(method, uri, response, 'Unable to create record')
twilio.base.exceptions.TwilioRestException:
HTTP Error Your request was:
POST /Accounts/['AC02ba1e07c83130f76679f2f334160fba']/Messages.json
Twilio returned the following information:
Unable to create record: The requested resource /2010-04-01/Accounts/['AC02ba1e07c83130f76679f2f334160fba']/Messages.json was not found
More information may be available here:
https://www.twilio.com/docs/errors/20404
I tried looking at the aforementioned docs, but couldn't find a reasonable solution. The account_sid and auth_token are both correct. How do I handle this?
Upvotes: 0
Views: 990
Reputation: 101
I believe the mistake is that you're declaring both account_sid
and auth_token
as list
and they should be string
:
account_sid = 'AC02ba1e07c83130f76679f2f334160fba'
auth_token = '*******************************'
client = Client(account_sid,auth_token)
Upvotes: 1