def post(self): customerID = self.get_cookie("digitATM") amount = self.get_argument("amount", "") if customerID is not None: RequestManager.withdraw(customerID, amount) self.write("<span style=\"text-align:center\">Withdrew {0} from customer ID {1}'s account. Return to <a href=\"/menu\"> the menu</a>.</span>".format(locale.currency(float(amount), grouping=True), customerID)) else: self.write("Although customer ID {0} exists, an error occurred when attempting to get the hash value for customer ID {0}.".format(customerID)) return
def __init__(self, url, dividerOffset): # request reqManager = RequestManager(url) res = reqManager.requests() self.htmlText = res.text # init every graph self.initGraphs(dividerOffset) self.renderer = GraphRenderer()
def post(self): customerID = self.get_argument("customerID", "") amount = self.get_argument("amount", "") jsondata = None with open("accounts.json", "r") as jsonfile: jsondata = json.load(jsonfile) customerHash = None if jsondata is not None and customerID in jsondata: customerHash = jsondata[customerID] else: self.write("Customer ID {0} is not a valid customer ID.".format(customerID)) return if customerHash is not None: RequestManager.withdraw(customerHash, amount) self.write("Deposited {0} in customer ID {1}'s account.".format(locale.currency(float(amount), grouping=True), customerID)) else: self.write("Although customer ID {0} exists, an error occurred when attempting to get the hash value for customer ID {0}.".format(customerID)) return
def get(self): customerID = self.get_cookie("digitATM") if customerID is not None: balance = RequestManager.getBalance(customerID) else: self.write("An error occurred when attempting to get the hash value for this customer.".format(customerID)) return if balance is not None: self.write("<span style=\"text-align:center\">Customer ID: {0}<br>Balance: {1}<br>Return to <a href=\"/menu\"> the menu</a>.</span>".format(customerID, balance)) return self.write("Customer ID {0} and its corresponding hash exist. However, the balance for this customer could not be determined.".format(customerID))
def post(self): customerID = self.get_argument("customerID", "") jsondata = None with open("accounts.json", "r") as jsonfile: jsondata = json.load(jsonfile) customerHash = None if jsondata is not None and customerID in jsondata: customerHash = jsondata[customerID] else: self.write("Customer ID {0} is not a valid customer ID.".format(customerID)) return if customerHash is not None: balance = RequestManager.getBalance(customerHash) else: self.write("Although customer ID {0} exists, an error occurred when attempting to get the hash value for customer ID {0}.".format(customerID)) return if balance is not None: self.write("Customer ID: {0}\nBalance: {1}".format(customerID, balance)) return self.write("Customer ID {0} and its corresponding hash exist. However, the balance for this customer could not be determined.".format(customerID))
def __init__(self, db, table="rooms"): RequestManager.__init__(self, db, table)
def __init__(self, db, table="instructors"): RequestManager.__init__(self, db, table)
def __init__(self, db, table="day_tb"): RequestManager.__init__(self, db, table)
def __init__(self, db, table="sections"): RequestManager.__init__(self, db, table)
def __init__(self, db, table="buildings"): RequestManager.__init__(self, db, table)
def __init__(self, db, table="students"): RequestManager.__init__(self, db, table)
def __init__(self, db, table="student_section"): RequestManager.__init__(self, db, table)
from flask import Flask, request, Response try: import apiai except ImportError: sys.path.append( os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) import apiai app = Flask(__name__) # Client Access Token for accessing our API AI Bot CLIENT_ACCESS_TOKEN = 'ENTER_YOUR_API_TOKEN' # Init apiai api ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN) request_manager = RequestManager() @app.route('/', methods=['GET']) def route_get(): response = '{"speech": "Yeah !"}' return Response(response=response, status=200, mimetype="application/json") @app.route('/', methods=['POST']) def route_post(): data = request.data rsp = request_manager.new_request(data) return rsp
def __init__(self, db, table="courses"): RequestManager.__init__(self, db, table)