def post(idict=None): session = Session() if not idict: idict = json.loads(request.data) obj = cmds_(**idict) session.add(obj) session.commit() odict = obj2dict(obj) session.close() return odict, 200
def get(filterDict={}): try: filterDict = dict(request.args.items()) except: pass session = Session() ts = session.query(tasks_).filter_by(**filterDict).order_by( tasks_.taskid).all() ts = [obj2dict(t) for t in ts] session.close() return ts
def get(mid): session = Session() m = session.query(macs_).filter(macs_.macid==mid).first() md = obj2dict(m) session.close() return md,200
def get(): session = Session() ms = session.query(macs_).all() mlist = [obj2dict(m) for m in ms] session.close() return mlist,200
def get(cid): session = Session() out = session.query(cmds_).filter(cmds_.cid == cid).first() out = obj2dict(out) session.close() return out, 200
def get(): session = Session() outs = session.query(cmds_).all() outs = [obj2dict(out) for out in outs] session.close() return outs, 200
def get(tid): session = Session() m = session.query(tasks_).filter(tasks_.taskid == tid).first() m = obj2dict(m) session.close() return m, 200