'How to find if api key is there in database with python

@app.route("/apikey/", methods=["POST"])
def apikeyget():
    key = "dfssddsafdsfadsfds"
    data = {
        "name": "User name",
        "api_key": key
    }
    all.insert_one(data)
    return render_template("index.html", api_key=key)

@app.route("/test/<string:apik>")
def test(apik):
    all.find_one(apik)

I have this code which adds an api key into my mongodb database and it does it successfully but I cant find the api key in the database.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source