Created
April 23, 2018 17:48
-
-
Save wasabigeek/e57434c11829fa65b9b7d566b127c2cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate_symbol_and_lookup(symbol): | |
if not symbol: | |
return apology("must provide symbol", 400) | |
stock = lookup(symbol) | |
if not stock: | |
return apology("invalid stock symbol", 400) | |
return stock | |
symbol = request.form.get("symbol") | |
# apology() doesn't get rendered if symbol is invalid | |
stock = validate_and_lookup(symbol) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment