title: Debugging a request/response in Python flask
body: <p>I am new to <a href="http://flask.pocoo.org/" rel="noreferrer">python2 flask</a> &amp; I am tasked to pretty print &amp; save the entire HTTP request and response to file. I don't quite understand how to print/inspect the request object, let alone the response.</p>
  
  <pre><code>from flask import Flask, request
  app = Flask(__name__)
  
  @app.route('/')
  def hi():
      print (request)
      return 'oh hai'
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>Any tips? Each request/response should be one file.</p>