当我尝试获取 nflx 的报价时,我的代码告诉我符号不存在下面是我的代码我找不到我的错误想法?

问题描述

这是检查代码输入正确的代码,然后在引用的模板上显示名称、价格和代码

@app.route("/quote",methods=["GET","POST"])
@login_required
def quote():
    """Get stock quote."""
    if request.method == "POST":
        # Ensure ticker was submitted
        if not request.form.get("symbol"):
            return apology("must input stock symbol")


        # Get symbol and make sure it exists
        quote = lookup(request.form.get("symbol"))
        if not quote:
            return apology("symbol does not exist")

        # to show company name,price,symbol
        else:
            return render_template("quoted.html",quote=quote)

    # User reached route via GET (as by clicking a link or via redirect)
    else:
        return render_template("quote.html")

解决方法

IEX 更改了 API。您可以在 helpers.py 的 this reddit post

中找到查找功能的新代码 ,

不,lookup() 在 helpers.py 中是正确的。我可以从 CS50 的答案中得到一个报价。有什么方法可以检查我的令牌是否正确?我可以登录我的财务应用,但无法获取报价。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...