def Start(self): db = DB() self.Select = self.Agent.GetSelectedClass() for s in self.Select: for c in s: new_c = db.GetClassByNumber(c.Number) new_c.Tag = c self.Add(new_c)
def api_feedback(): try: data = request.get_json(force=True) db = DB() db.FeedBack(data['name'], data['email'], data['subject'], data['message']) return (jsonify({'check': True})) except: TB.print_exc() return (jsonify({'check': False}))
def api_classinfo(): try: data = request.get_json(force=True) db = DB() c = db.CrawlClassByNumber(data['number']) d = c.ToDict() d['Check'] = True return (jsonify(d)) except: TB.print_exc() return (jsonify({'check': False}))
def classes(): try: global Global a = Global['MyAgent'](request) return render_template('classes.html', agent=a, schedule=Schedule(a), db=DB()) except: TB.print_exc() return redirect(url_for('logout'))
def api_classes(): try: data = request.get_json(force=True) db = DB() cs = db.Classes(data['dept'], data['teacher'], data['name'], data['number'], data['week'], data['sect']) result = [] for c in cs: result.append(c.ToDict()) return (jsonify(result)) except: TB.print_exc() return (jsonify({'check': False}))
def api_login(): try: global Global a = Global['MyAgent'](request) data = request.get_json(force=True) db = DB() login = a.Login(data['username'], data['password'], data['validcode']) if login[0]: srcpath = 'static/img/validcode/' + data['validcodeSrc'] corpath = 'static/img/validcode/' + data['validcode'] + '.' + data[ 'validcodeSrc'] OS.rename(srcpath, corpath) return (jsonify({'check': login[0], 'msg': login[1]})) except: TB.print_exc() return (jsonify({'check': False}))
def api_get_feedbacks(): db = DB() return (jsonify(db.GetFeedBacks()))
# -*- coding: utf-8 -*- __author__ = "Hua777" __copyright__ = "Copyright 2018, Hua777" __version__ = "2.0" __email__ = "*****@*****.**" from ClassesDB import ClassesDB as DB db = DB() db.Crawl()