# Print HTTPFlow to do further processing

**URL:** <https://discourse.mitmproxy.org/t/print-httpflow-to-do-further-processing/321>\
**Category:** help\
**Created:** [January 26, 2017, 9:08pm UTC](https://discourse.mitmproxy.org/t/print-httpflow-to-do-further-processing/321 "2017-01-26T21:08:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![farnett44](https://avatars.discourse-cdn.com/v4/letter/f/87869e/32.png) [@farnett44](https://discourse.mitmproxy.org/u/farnett44)\
**Post date:** [January 26, 2017, 9:08pm UTC](https://discourse.mitmproxy.org/t/print-httpflow-to-do-further-processing/321/1 "2017-01-26T21:08:35Z")

</div>

Hello everyone,

I am trying to read in the requests from a flow and put them out to a file as well as send them to a java program for more processing. I had no issue getting the requests and parsing those, however, I’m not sure how to print out the body of the response object. I’ve read the HTTPResponse documentation but didn’t see anything that would allow me to view and manipulate the body directly.  
I’ve tried [ctx.log.info](http://ctx.log.info)(flow.response.content), [ctx.log.info](http://ctx.log.info)(flow.response.text) and several other variants of this but I’m not sure how to handle this object for my needs. This could also just be my lack of python knowledge.

Apologies if this is a very basic question but I’ve been going through the documentation but I’ve been unable to figure out how to do this. Thanks!

---

<div class="post-metadata">

**Author:** ![ujjwal96](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/ujjwal96/32/111_2.png) [@ujjwal96](https://discourse.mitmproxy.org/u/ujjwal96)\
**Post date:** [February 5, 2017, 6:55pm UTC](https://discourse.mitmproxy.org/t/print-httpflow-to-do-further-processing/321/2 "2017-02-05T18:55:12Z")

</div>

Hi, try flow.response.get\_text()  
[ctx.log.info](http://ctx.log.info)(flow.response.get\_text())

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [February 8, 2017, 9:46am UTC](https://discourse.mitmproxy.org/t/print-httpflow-to-do-further-processing/321/3 "2017-02-08T09:46:56Z")

</div>

FWIW, the API is described at [http://docs.mitmproxy.org/en/stable/scripting/api.html](http://docs.mitmproxy.org/en/stable/scripting/api.html).

---

<div class="post-metadata">

**Author:** ![farnett44](https://avatars.discourse-cdn.com/v4/letter/f/87869e/32.png) [@farnett44](https://discourse.mitmproxy.org/u/farnett44)\
**Post date:** [February 28, 2017, 12:41am UTC](https://discourse.mitmproxy.org/t/print-httpflow-to-do-further-processing/321/4 "2017-02-28T00:41:30Z")

</div>

My parameters also changed where I am now looking for the request body, however, I was still facing the same issue.  
I’m not sure the exact difference between all of the text methods but this one ended up working out for me:  
flow.request.content.decode()

I also took a lot from this example:

> <https://github.com/mitmproxy/mitmproxy/blob/master/examples/complex/har_dump.py>
