title: Return a requests.Response object from Flask
body: <p>I'm trying to build a simple proxy using Flask and requests. The code is as follows:</p>
  
  <pre><code>@app.route('/es/&lt;string:index&gt;/&lt;string:type&gt;/&lt;string:id&gt;',
             methods=['GET', 'POST', 'PUT']):
  def es(index, type, id):
      elasticsearch = find_out_where_elasticsearch_lives()
      # also handle some authentication
      url = '%s%s%s%s' % (elasticsearch, index, type, id)
  
      esreq = requests.Request(method=request.method, url=url,
                               headers=request.headers, data=request.data)
      resp = requests.Session().send(esreq.prepare())
      return resp.text
  </code></pre>
  
  <p>This works, except that it loses the status code from Elasticsearch. I tried returning <code>resp</code> (a <code>requests.models.Response</code>) directly, but this fails with</p>
  
  <pre><code>TypeError: 'Response' object is not callable
  </code></pre>
  
  <p>Is there another, simple, way to return a <code>requests.models.Response</code> from Flask?</p>