Search code examples
pythonmitmproxy

mitmproxy, how to get the response time/duration of a call?


I am able to get the response code, body, url and querystring form a request and response but I am not able to fetch time taken by a call.

We have

  • flow.response.code
  • flow.response.content
  • flow.response.url

does mitm has anything to get duration for the call.


Solution

  • The mitmproxy datastructures are documented at http://docs.mitmproxy.org/en/latest/dev/models.html.

    For example:

    def request(context, flow):
        print(flow.request.timestamp_start)