def check(): try: login = auth(request.form) if login == "Success": if Database.check_channel(request.form['channel']) == []: return "Invalid channel request" messages = Database.fetch_messages(request.form['channel']) if len(messages) > int(request.form['num']): return "Yes." return "No." except Exception as e: return str(e), 403
def get(): try: login = auth(request.form) if login == "Success": if Database.check_channel(request.form['channel']) == []: return "Invalid channel request" list = {} for message in Database.fetch_messages(request.form['channel']): current = {'author': message[2], 'message': message[1]} list[message[0]] = current return list except Exception as e: return str(e), 403