My goal is to run a Flask app that will be given a URL of this form where the ids vary:
http://localhost:5000/Longword/game?firstid=123&secondid=456&thirdid=789
and return a simple page outputting something like
First id = 123, second id = 456, third id = 789
I run this script, and when hardcoding in an example URL I cannot get request args to return anything but None. I have tried formatting the int as a string and different things like that -- in no circumstances can I get request args to work.
import os
import json
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def main():
return "on main home page"
@app.route('/longword/gameid=123&playerid=456')
def Longword():
user = request.args.get('gameid')
return "got hardcode %d" % gameid
My second issue, which will be tackled after I can get request args going, is that I cannot configure route() in such a way to handle variable URLs. I am only able to load pages by hardcoding them into route. I made a separate attempt to do this using sessions but was equally unsuccessful.
route('/longword/')without?..... Then tryhttp://localhost:5000/longword/?gameid=123&playerid=456. BTW: you getuser =but later you usegameidwhich doesn't exists. Run code in debug mode to see more.