Created
May 4, 2015 20:49
-
-
Save RobSpectre/01801cf0810250bcd60e to your computer and use it in GitHub Desktop.
Flask app for returning sentiment of text messages with Twilio
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 | |
from textblob import TextBlob | |
app = Flask(__name__) | |
@app.route('/sms', methods=['POST']) | |
def sms(): | |
body = request.form['Body'] | |
blob = TextBlob(body) | |
response = twiml.Response() | |
response.message(str(blob.sentiment)) | |
return str(response) | |
if __name__ == "__main__": | |
app.debug = True | |
app.run() |
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
textblob==0.9.0 | |
twilio==4.0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment