Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route("/quote", methods=["GET","POST"])
- @login_required
- def quote():
- #Ensure method of access is get
- if request.method == "GET":
- #take symbol from user
- symbl = request.form.get("symbol")
- if not symbl:
- return apology ("Must enter the symbol")
- #Lookup and save dict in quoted
- quoted = lookup(symbl)
- #If symbol is invalid return apology
- if not quoted:
- return apology ("Invalid stock")
- #render values to quoted.html
- else:
- return render_template ("quoted.html", name = quoted.name,price = quoted.price, symbol = quoted.symbol)
- else:
- return redirect (url_for("quote"))
Add Comment
Please, Sign In to add comment