diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-11-21 02:16:20 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-11-21 02:28:10 +0100 |
commit | 9af8f4bb31c94a25780a4189bffa406906249626 (patch) | |
tree | cf52f1c312b7bac3d83d796d6b03bb33b4556f26 /examples/stub.py | |
parent | f74e561524d04c93cd7953f34e78ebe67eaa58a8 (diff) | |
download | mitmproxy-9af8f4bb31c94a25780a4189bffa406906249626.tar.gz mitmproxy-9af8f4bb31c94a25780a4189bffa406906249626.tar.bz2 mitmproxy-9af8f4bb31c94a25780a4189bffa406906249626.zip |
organize examples
This commit is largely based on work by Thiago Arrais (@thiagoarrais)
and Shane Bradfield (@l33tLumberjack). I wasn't really able to get their
PR reasonably merged onto the latest master, so I reapplied their changes
manually here and did some further improvements on that.
Diffstat (limited to 'examples/stub.py')
-rw-r--r-- | examples/stub.py | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/examples/stub.py b/examples/stub.py deleted file mode 100644 index 4f5061e2..00000000 --- a/examples/stub.py +++ /dev/null @@ -1,87 +0,0 @@ -import mitmproxy -""" - This is a script stub, with definitions for all events. -""" - - -def start(): - """ - Called once on script startup before any other events - """ - mitmproxy.ctx.log("start") - - -def configure(options, updated): - """ - Called once on script startup before any other events, and whenever options changes. - """ - mitmproxy.ctx.log("configure") - - -def clientconnect(root_layer): - """ - Called when a client initiates a connection to the proxy. Note that a - connection can correspond to multiple HTTP requests - """ - mitmproxy.ctx.log("clientconnect") - - -def request(flow): - """ - Called when a client request has been received. - """ - mitmproxy.ctx.log("request") - - -def serverconnect(server_conn): - """ - Called when the proxy initiates a connection to the target server. Note that a - connection can correspond to multiple HTTP requests - """ - mitmproxy.ctx.log("serverconnect") - - -def responseheaders(flow): - """ - Called when the response headers for a server response have been received, - but the response body has not been processed yet. Can be used to tell mitmproxy - to stream the response. - """ - mitmproxy.ctx.log("responseheaders") - - -def response(flow): - """ - Called when a server response has been received. - """ - mitmproxy.ctx.log("response") - - -def error(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. - """ - mitmproxy.ctx.log("error") - - -def serverdisconnect(server_conn): - """ - Called when the proxy closes the connection to the target server. - """ - mitmproxy.ctx.log("serverdisconnect") - - -def clientdisconnect(root_layer): - """ - Called when a client disconnects from the proxy. - """ - mitmproxy.ctx.log("clientdisconnect") - - -def done(): - """ - Called once on script shutdown, after any other events. - """ - mitmproxy.ctx.log("done") |