jeudi 26 septembre 2019

How to do variable as part of url?

I am new to flask and I want a structure my GET request URL where it follows:

/api/results?date={YYYY-MM-DD}
(e.g. 2019-09-20)

I've tried @app.route('/api/results?ddate=', methods=['GET']) def get_game(game_id): print("game: ", game_id) return jsonify(game_id)

i've also tried:

@app.route('/api/results?ddate=game_id', methods=['GET'])
def get_game():
    game_id= request.args.get('ddate')
    print("game: ", game_id)
    return jsonify(game_id)



Aucun commentaire:

Enregistrer un commentaire