In [1]:
from flask import Flask         
from twilio.rest import TwilioRestClient

In [17]:
account_sid="AC9c962d8cbfa9d14e338c0b37082d6826"
auth_token="0f7eb705b0010671e42fe3b2ee793707"

In [18]:
client = TwilioRestClient(account_sid, auth_token)

In [19]:
number='+61429519148'

In [20]:
message = client.messages.create(to="0424063855", from_=number, body="Hello there!")

In [21]:
message = client.messages.create(to="0424063855", from_=number,
                                     body="Hello there!",
                                     media_url=['https://demo.twilio.com/owl.png', 'https://demo.twilio.com/logo.png'])


---------------------------------------------------------------------------
TwilioRestException                       Traceback (most recent call last)
<ipython-input-21-e62c98fdbc55> in <module>()
      1 message = client.messages.create(to="0424063855", from_=number,
      2                                      body="Hello there!",
----> 3                                      media_url=['https://demo.twilio.com/owl.png', 'https://demo.twilio.com/logo.png'])

/home/jun_gentoo/anaconda3/lib/python3.5/site-packages/twilio/rest/resources/messages.py in create(self, from_, **kwargs)
    120         """
    121         kwargs["from"] = from_
--> 122         return self.create_instance(kwargs)
    123 
    124     @normalize_dates

/home/jun_gentoo/anaconda3/lib/python3.5/site-packages/twilio/rest/resources/base.py in create_instance(self, body)
    363         """
    364         resp, instance = self.request("POST", self.uri,
--> 365                                       data=transform_params(body))
    366 
    367         if resp.status_code not in (200, 201):

/home/jun_gentoo/anaconda3/lib/python3.5/site-packages/twilio/rest/resources/base.py in request(self, method, uri, **kwargs)
    198 
    199         kwargs['use_json_extension'] = self.use_json_extension
--> 200         resp = make_twilio_request(method, uri, auth=self.auth, **kwargs)
    201 
    202         logger.debug(resp.content)

/home/jun_gentoo/anaconda3/lib/python3.5/site-packages/twilio/rest/resources/base.py in make_twilio_request(method, uri, **kwargs)
    162 
    163         raise TwilioRestException(status=resp.status_code, method=method,
--> 164                                   uri=resp.url, msg=message, code=code)
    165 
    166     return resp

TwilioRestException: HTTP 400 error: Number: +61429519148 has not been enabled for MMS

In [2]:
from flask import Flask        
import twilio.twiml        
app = Flask(__name__)        
@app.route("/insms", methods=['GET', 'POST'])        
def respond_sms():            
    resp = twilio.twiml.Response()            
    resp.message("Thanks for your query. We will get back to you soon")        
    return str(resp)        

if __name__ == "__main__":        
    app.run(debug=True)


 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
An exception has occurred, use %tb to see the full traceback.

SystemExit: 1
/home/jun_gentoo/anaconda3/lib/python3.5/site-packages/IPython/core/interactiveshell.py:2889: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
  warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

In [ ]: