Skip to content

Instantly share code, notes, and snippets.

@RobSpectre
Created September 7, 2013 21:23
Show Gist options
  • Save RobSpectre/6479447 to your computer and use it in GitHub Desktop.
Save RobSpectre/6479447 to your computer and use it in GitHub Desktop.
Pseudo code example of gather with python
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