def setUp(self): self.dispatcher = Dispatcher()
from app.i18n import _ from app.model.config import Config from app.model.sms_request import SmsRequest from app.model.user import User from app.util.flask_common import enable_json_error, log_request app = Flask(__name__) enable_json_error(app) @app.before_request def log(): log_request(app) dispatcher = Dispatcher() dispatcher.route(PlantCommand, PlantAction) dispatcher.route(HarvestCommand, HarvestAction) dispatcher.route(SellCommand, SellAction) dispatcher.route(QueryCommand, QueryAction) dispatcher.route(BroadcastCommand, BroadcastAction) @app.route('/v1/sms/twilio', methods=['POST']) def incoming_twilio_sms(): sms = SmsRequest(id=SmsRequest.id(), from_number=request.form.get('From'), to_number=request.form.get('To'), body=request.form.get('Body'), twilio_message_id=request.form.get('MessageSid'), from_city=request.form.get('FromCity'),