def handleTeacherVideos(): if (request.method == 'POST'): try: questionID = request.args.get('userID') # check if the post request has the file part if 'file' not in request.files: for i in request.files: print(i) file = request.files['file'] print('teletabi') # if user does not select file, browser also # submit an empty part without filename if file.filename == '': print('no selected file') if file and allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) return 't' else: return 'k' except Exception as ex: print(str(ex)) return 'k' else: try: userID = request.args.get('userID') user = User.getUserByID(userID) videos = user.videos titleList = [] for video in videos: titleList.append({'title': video}) print('a') return json.dumps(titleList) except Exception as error: return str(error)