-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
27 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
from flask import Flask | ||
from flask.ext.sqlalchemy import SQLAlchemy | ||
from flask.ext.cors import CORS | ||
import settings | ||
|
||
app = Flask(__name__) | ||
app.config['SQLALCHEMY_DATABASE_URI'] = settings.DB_URI | ||
db = SQLAlchemy(app) | ||
cors = CORS(app) | ||
|
||
from app import views, models |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import re | ||
from flask import Flask | ||
from flask import request | ||
from twilio import twiml | ||
from app import app | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route("/", methods= ["GET", "POST"]) | ||
def replyToSms(): | ||
resp = twiml.Response() | ||
body = request.form.get('Body') | ||
tokens = re.sub(r'\s', '', body).split('*') | ||
# If the message is malformed, remind the user of format | ||
if (len(tokens) != 3): | ||
#resp.message("Sorry. Please use format: my name * their name * message") | ||
resp.message(u'عذراً. الرجاء إستعمال هذا التصميم : إسمي*اسمهم*الرسالة') | ||
else: | ||
# TODO : store into DB | ||
# TODO : search database and if there's a match, return relevant info. | ||
#resp.message("Bulletin posted. Pending match.") | ||
resp.message(u'لقد تم نشر هذا البيان | التطابق في قيد الانتظار') | ||
# if no match, just say bulletin was posted but no match yet. | ||
return str(resp) | ||
|
||
if __name__ == "__main__": | ||
app.run(debug=True) | ||
app.run(port=5000, debug=True) |