Reputation: 12384
I'm running Flask on App Engine and I'm having trouble getting the request parameters of an issued request.
Here's my function being called:
@APP.route('/some_model/new', methods = ['PUT'])
def new_some_model():
prop1 = request.args.get('prop1')
prop2 = request.args.get('prop2')
import logging
logging.error(prop1)
logging.error(prop2)
And then I'm running the following command with curl:
curl -X PUT -d "prop1=prop1&prop2=prop2" http://myapp.appspot.com/some_function/new
I've tried several variations, but with no success. The curl command returns a "500 server error" and in the app-log I see that both prop1 and prop2 are None
at the point of logging. The server error came from the properties being required later on. So the problem is that the request.args.get() is returning nothing. Any suggestions on what I might be doing wrong? Thank you much!
Upvotes: 1
Views: 1587
Reputation: 14210
Data sent by POST
or PUT
will be in request.form
, request.args
is for parsed query string data.
Upvotes: 7