Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flask second parameter returns null

when I try to return the second argument background for my Flask application, I get a null value, but it works fine for original

> curl http://127.0.0.1:5000?original="sdsd" & background="/szzzzzz" 

@app.route('/',methods=['GET'])
def API():
    if request.method == 'GET':
        original = request.args.get('original')
        background = request.args.get('background')
        result =  background
        return jsonify(result)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Likely your shell is ignoring the part after the & because that character is signaling the shell the run the first part of the command in the background.

Try running your curl command like this:

curl "http://127.0.0.1:5000?original=sdsd&background=/szzzzzz" 

The quotation marks will escape the & character so that the entire string is passed to curl.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading