I am using curl to make a request to a Flask route that expects multiple query params. However, the log shows only the first param in the url, and Flask doesn't see the second param. 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¶m2=2
127.0.0.1 - - [01/Jun/2015 21:35:10] "GET /path?param1=1 HTTP/1.1" 200 -
None
[('param1', u'1')]
See Bidhan's comment here. I was using curl
without putting my URL inside double quotes.
To quote:
If you're using curl then you need to pass the url inside of quotes. It should look like
curl "localhost:5000/path?param1=1¶m2=2"
. In the shell, & is used for forking processes and doesn't behave like you would expect it to. – Bidhan A
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With