from flask import Flask, redirect, url_for, request, render_template import cx_Oracle as cxo app = Flask(__name__) def getHotelAvail(hotelid): conn = cxo.connect('hr','hr','192.168.56.101:1521/orcl') c1 = conn.cursor() c1.prepare('select room_type, avail from avail where hotel_id = :hotelid') c1.execute(None,{'hotelid':int(hotelid)}) hotelavail = dict(c1.fetchall()) return hotelavail @app.route('/avail', methods= ['POST','GET']) def avail(): if request.method == 'GET': hotelid = int(request.args.get('hotelid')) hotelavail = getHotelAvail(hotelid) return render_template('list_avail.html',dict=hotelavail) else: return Null if __name__ == '__main__': app.run(debug=1)