def index(): """Show portfolio of stocks""" user_id = session["user_id"] # get user data user = get_user_details(db, user_id) # get user stocks (grouped by symbol - sum of bought stocks - sum of sold stocks by symbol) stocks, total_value = get_user_stocks(db, user_id) return render_template("index.html", stocks=stocks)
def get_user_info_post(): log.info('/get_user_info') pretty_print_POST(request) response = json.loads(request.data) statement_validate = query.get_user_info_validate_user.format(response["userid"]) log.info("query: {}".format(statement_validate)) result = db_fetch(statement_validate) if len(result) == 0: return Response(json.dumps({"error": "user not registered"}), headers=HEADER, status=200, mimetype='application/json') if result[0][0] != response["password"]: return Response(json.dumps({"error": "password invalid"}), headers=HEADER, status=200, mimetype='application/json') user_data = get_user_details(response["userid"]) return Response(json.dumps(user_data), headers=HEADER, status=200, mimetype='application/json')
def _check_email_login(): email = request.form["email"] if get_user_details(email) is None: return "false" else: return "true"
def get_user_info_get(): log.info('/get_user_info') args = request.args.to_dict()["userid"] user_data = get_user_details(args) return Response(json.dumps(user_data), headers=HEADER, status=200, mimetype='application/json')