def users(): handler = UsersHandler() # Json format #json = {'first_name': 'Heidi', 'last_name': 'Doe', 'users_phone': '7873334554', 'users_email': '*****@*****.**', # 'users_password': '******'} if request.method == 'POST': print(request.json) print(handler.checkUser(request.json)) if ( handler.checkUser(request.json) is None ): #check if user already exist checking name and last , phone or email return handler.registerUser( request.json) #form #returns users info added else: return jsonify(Error="Invalid registration."), 405 elif request.method == 'GET': return handler.getAllUsers() else: return jsonify(Error="Method not allowed."), 405
def users(): handler = UsersHandler() return handler.getAllUsers()