Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route("/quote", methods=["GET", "POST"])
- @login_required
- def quote():
- """Get stock quote."""
- # if user reached route via POST
- if request.method == "POST":
- # ensure symbol was submitted
- if not request.form.get("symbol"):
- return apology("symbol required")
- # look symbol up on Yahoo Finance and check if it was successful
- stock = lookup(request.form.get("symbol"))
- if not stock:
- apology("symbol is invalid/wasn't found or something else went wrong")
- return render_template("quoted.html", name="stock")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement