Flask sees only the first parameter of several parameters sent using curl

I use curl to request a Flask route that expects several request parameters. However, the log shows only the first parameter in the URL, and Flask does not see the second parameter. What is going wrong?

@app.route('/path', methods=['GET']) def foo(): print request.args.get('param2') req = request.args.items() print req 
 curl http://localhost:5000/path?param1=1&param2=2 
 127.0.0.1 - - [01/Jun/2015 21:35:10] "GET /path?param1=1 HTTP/1.1" 200 - None [('param1', u'1')] 
+7
python flask
source share
1 answer

See Bidhan comment here . I used curl without putting my URL inside double quotes.

Quote:

If you use curl, you need to pass the url inside the quotes. It should look like curl "localhost:5000/path?param1=1¶m2=2" . It is wrapped and used for branching processes and does not behave as you would expect it to. - Bidhan A

+14
source share

All Articles