Created
September 7, 2013 21:23
-
-
Save RobSpectre/6479447 to your computer and use it in GitHub Desktop.
Pseudo code example of gather with python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask import request | |
from twilio import twiml | |
app = Flask(__name__) | |
@app.route('/gather', methods=['POST']) | |
def gather(): | |
response = twiml.Response() | |
with response.gather(action='/handler') as g: | |
g.say("Press 1 for Rob.") | |
g.say("Press 2 for Caine.") | |
return str(response) | |
@app.route('/handler', methods=['POST']) | |
def handler(): | |
response = twiml.Response() | |
digits = request.get('Digits') | |
if digits == '1': | |
# pseudo call | |
call.rob | |
else: | |
call.caine | |
if __name__ == "__main__": | |
app.debug = True | |
app.run(host='0.0.0.0', port=5000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment