from flask import Flask, request
from twilio import twiml


app = Flask(__name__)

@app.route("/voice", methods=['GET', 'POST'])
def voice():
    """Respond to incoming phone calls with a text message."""
    # Start our TwiML response
    resp = twiml.Response()

    # Read a message aloud to the caller
    resp.say("Hello! You will get an SMS message soon.")

    # Also tell Twilio to send a text message to the caller
    resp.sms("This is the ship that made the Kessel Run in fourteen parsecs?")

    return str(resp)

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

from flask import Flask, request, redirect
import twilio.twiml

app = Flask(__name__)

@app.route("/", methods=['GET', 'POST'])
def hello_monkey():
    """Respond to incoming calls with a simple text message."""

    resp = twilio.twiml.Response()
    resp.say("Hello! You will get an SMS message soon.")
    resp.sms("This is the ship that made the Kessel Run in fourteen parsecs?")
    return str(resp)

if __name__ == "__main__":
    app.run(debug=True)
--- 
+++ 
@@ -1,15 +1,21 @@
-from flask import Flask, request, redirect
-import twilio.twiml
+from flask import Flask, request
+from twilio import twiml
+
 
 app = Flask(__name__)
 
-@app.route("/", methods=['GET', 'POST'])
-def hello_monkey():
-    """Respond to incoming calls with a simple text message."""
+@app.route("/voice", methods=['GET', 'POST'])
+def voice():
+    """Respond to incoming phone calls with a text message."""
+    # Start our TwiML response
+    resp = twiml.Response()
 
-    resp = twilio.twiml.Response()
+    # Read a message aloud to the caller
     resp.say("Hello! You will get an SMS message soon.")
+
+    # Also tell Twilio to send a text message to the caller
     resp.sms("This is the ship that made the Kessel Run in fourteen parsecs?")
+
     return str(resp)
 
 if __name__ == "__main__":
Clean up Send SMS and MMS Python example
