Print all POST request parameters without knowing their names

How to print all parameters that were passed using a POST request using Python and a jar?

I know how to set a parameter by name

from flask import request key = request.args.get('key') 

But I'm not sure why this did not work for me:

 for a in request.args: print "argument: " + a 
+7
python post flask web-services request
source share
1 answer

request.args returns a MultiDict . It can have several values ​​for each key. To print all the parameters, you can try:

Below is the code for URLs with added parameters, for example:

  http://www.webservice.my/rest?extraKey=extraValue multi_dict = request.args for key in multi_dict: print multi_dict.get(key) print multi_dict.getlist(key) 

For parameters embedded in a POST request, in the form of a form:

 dict = request.form for key in dict: print 'form key '+dict[key] 

See an example here and you will have a good idea.

+11
source share

All Articles