Blake G
Blake G

Reputation: 581

HTTP 404 - Cannot pass url parameters to a flask route

Any help with this is appreciated.

I am trying to pass a couple parameters to my Flask application in the URL query string.

This is my Flask code

@application.route('/registeruser/', methods=['GET'])
def store_on_cloudant():
    qr = request.args.get('qr_code')
    fb_access_tok = request.args.get('fb_token')
    db.save({
        'qr': qr,
        'fb_access_tok': fb_access_tok

    })
    return

Here is the URL , I am using a GET because I am accessing the page in my browser

localhost:5000/registeruser/qr_code=qr12345&fb_token=token12345

I get an HTTP 404 error. Am I passing parameters correctly?

Upvotes: 2

Views: 3382

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1121486

You are missing a question mark:

localhost:5000/registeruser/?qr_code=qr12345&fb_token=token12345

Without the question mark the parameters are part of the URL path, not the query parameters.

Upvotes: 6

Related Questions