0

I used the code from the Twilio website to send a text message using python. I used real values, that I obtained during registration in the actual code. There aren't any XXXXXX in my program.

I removed the {{}} too. the code's still not working.

from twilio.rest import TwilioRestClient

account_sid = "{{ AC3XXXXXXXXXXXXXXXXXXXXXXXXXXXXX }}" # Your Account SID from www.twilio.com/console
auth_token  = "{{ 04e4c31XXXXXXXXXXXXXXXXXXXXXXXXXX }}"  # Your Auth Token from www.twilio.com/console

client = TwilioRestClient(account_sid, auth_token)

message = client.messages.create(body="Hello from python. ",
    to="+447XXXXXXXXXX",    # Replace with your phone number
    from_="+4417XXXXXXXXXXX") # Replace with your Twilio number

print(message.sid)

This is the error I'm getting. What does this mean? Thanks!

Traceback (most recent call last):
  File "C:/Users/Pawel/Desktop/Courses/Udacity/Python/send_text.py", line 10, in <module>
    from_="+441753254382") # Replace with your Twilio number
  File "C:\Python27\lib\site-packages\twilio-6.3.dev0-py2.7.egg\twilio\rest\resources\messages.py", line 122, in create
    return self.create_instance(kwargs)
  File "C:\Python27\lib\site-packages\twilio-6.3.dev0-py2.7.egg\twilio\rest\resources\base.py", line 365, in create_instance
    data=transform_params(body))
  File "C:\Python27\lib\site-packages\twilio-6.3.dev0-py2.7.egg\twilio\rest\resources\base.py", line 200, in request
    resp = make_twilio_request(method, uri, auth=self.auth, **kwargs)
  File "C:\Python27\lib\site-packages\twilio-6.3.dev0-py2.7.egg\twilio\rest\resources\base.py", line 164, in make_twilio_request
    uri=resp.url, msg=message, code=code)
TwilioRestException: 
[31m[49mHTTP Error[0m [37m[49mYour request was:[0m

[36m[49mPOST https://api.twilio.com/2010-04-01/Accounts/{{ AC3ea248ea5628ce024619440468334835 }}/Messages.json[0m

[37m[49mTwilio returned the following information:[0m

[34m[49m[0m
2
  • Did you forget to remove that second ACEeaXXXXX value? Commented Jun 10, 2016 at 15:00
  • Anyways, it looks like your terminal can't display the encoding of those messages. That should read HTTP Error: Your request was: Commented Jun 10, 2016 at 15:03

1 Answer 1

4
account_sid = "{{ account_sid }}" # Your Account SID from www.twilio.com/console

This does not mean place the value in the {{ }}. It means replace that entire string with your value.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.