__mitmproxy__ has a powerful event-drive scripting API, that allows you to modify flows on-the-fly or rewrite previously saved flows locally. ## Events
start(ctx) | Called once on startup, before any other events. |
clientconnect(ctx, ClientConnect) | Called when a client initiates a connection to the proxy. Note that a connection can correspond to multiple HTTP requests. |
request(ctx, Flow) | Called when a client request has been received. |
response(ctx, Flow) | Called when a server response has been received. |
error(ctx, Flow) | Called when a flow error has occured, e.g. invalid server responses, or interrupted connections. This is distinct from a valid server HTTP error response, which is simply a response with an HTTP error code. |
clientdisconnect(ctx, ClientDisconnect) | Called when a client disconnects from the proxy. |
done(ctx) | Called once on script shutdown, after any other events. |