#StackBounty: #python-3.x #flask Adding query parameter for every flask GET request

Bounty: 200

Trying to figure out the right mechanism to use here.

I want to modify the flask request coming in every time.

I think the request is immutable, so I am trying to figure out if this mechanism exists.

Basically, I want to append a string onto the end of the request coming in.

I can hook into the request and the right time in a before_request handler like this:

@app.before_app_request
def before_request_custom():
    # Get the request
    req = flask.request

    method = str(req.method)

    if method == "GET":
        # Do stuff here
        pass

But I am not sure what to actually do to add this in, and don’t see a way to accomplish it…I guess i could redirect, but that seems silly in this case. Any ideas?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.