Separate each request

Hello everyone. I’ve just started using mitmproxy and I’m relatively new to python as well. I’ve successfully installed mitmproxy via docker and have been using it for a couple of hours.

What I want to do with it is not to just record network traffic, but I want to be able to somehow distinguish one request from another. More specifically I want to be able to say ‘This is the start of the request A with all it’s redirections, js, css and such. And here it ends’. And that would be just perfect if I could do that live. If this feature is aleady there, how exactly can I use it? Right now I am using selenium with Chrome webrdiver to make requests and I’ve set the proxy to the mitmproxy docker instance.

Can you advise me anything? I don’t really need much info about the request except for the size, method, domain, path and response code. I can discard everything else. Is there a relatively simple way of doing that?

Maybe I should just start reading the logs of mitmproxy before I make the request and just stop when it’s done? What would you do?

Was busy doing other stuff. I think I’ve figured it out. I’ll just write a custom logger and send a special request before and after the actual chain of requests I want to record. Hope It’s gonna work. If you have a better idea or you know that this won’t work, feel free to tell me.