def userlist(): try: users = getUser() return render_template('user_list.html', data=users) except Exception as e: logger.insertLog('Exception:', makeError(e)) return handle_error(e)
def face_recognition_func(): try: # return obj_face_recognition.face_recognition_func() return jsonify({"status": "Login success"}) except Exception as e: logger.insertLog('Exception:', makeError(e)) return handle_error(e)
def userdetail(username): try: detail = getUserDetail(username) # return jsonify(detail) return render_template('user_detail.html', detail = detail, user=username) except Exception as e: logger.insertLog('Exception:', makeError(e)) return handle_error(e)
def remove(isall): try: if not request.get_json(): abort(400) data = request.get_json() active = True if isall == 'true' else False isresult = removeProfile(data, isall=active) message = "Success" if isresult else "Fails" result = {"status": isresult, "message": message, 'router': 'userdetail'} return jsonify(result) except Exception as e: logger.insertLog('Exception', makeError(e)) return handle_error(e)
def addUserImage(): try: if not request.json: abort(400) data = request.get_json() imgstr = data.get('image_data') # re.search(r'base64,(.*)', str(data.get('image_data'))).group(1) makeFile(imgstr, data.get('username'), data.get('index')) flag = False if data.get('index') == 10: moveFile() training(data.get('username')) flag = True message = 'Upload succes' if flag: message = 'Upload and Training success' result = {"index": data.get('index'), "status": True, "message": message} return jsonify(result) except Exception as e: logger.insertLog('Exception:', makeError(e)) return handle_error(e)
def decorated_function(*args, **kwargs): try: return func(*args, **kwargs) except Exception as e: logger.insertLog('Exception:', makeError(e)) return handle_error(e)