I needed to debug the Flask request. After googeling around for a while I ran into a cool trick on Stack Overflow using the
pprint module. The
pprint module provides a capability to “pretty-print” arbitrary Python data structures in a form which can be used as input to the interpreter.
import pprint str = pprint.pformat(request.environ, depth=5)
This same trick can be used with all the Flask variables.
request.args: the key/value pairs in the URL query string
request.form: the key/value pairs in the body, as sent by a HTML POST form
request.files: the files in the body, which Flask keeps separate from
argsif keys overlap