def post(self): requests = JsonUtil.stringToCollection(request.data) try: email = requests['email'] password = requests['password'] print 'email: {0}, password: {1}'.format(email, password) user = User.query.filter(User.email == email).first() if user is not None and user.password == password : return Response(JsonUtil.objectToJson(user), mimetype='application/json') else: return {'flash':'Invalid email and password'}, 403 except Exception as e: print e return 'Database error', 500
def test_(self): line1 = '{"email":"*****@*****.**","password":"******"}' line2 = '{email:[email protected],password:passwd}' print JsonUtil.stringToCollection(line1) # print JsonUtil.stringToCollection(line2)