diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-09-01 12:11:00 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-09-01 12:11:00 +1200 |
commit | 9306e80e65bfa7e0945f4163536e2059e302e710 (patch) | |
tree | be58270f142a6227c28ad3f8d9e9e2c1629e5bd1 /examples | |
parent | b4b2e5fd3431ea3c8b8f00b8f92e8c7fc6f309ae (diff) | |
download | mitmproxy-9306e80e65bfa7e0945f4163536e2059e302e710.tar.gz mitmproxy-9306e80e65bfa7e0945f4163536e2059e302e710.tar.bz2 mitmproxy-9306e80e65bfa7e0945f4163536e2059e302e710.zip |
Adjust flowbasic example for Options API changes
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/flowbasic | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/examples/flowbasic b/examples/flowbasic index 74af4e08..2e3458b1 100755 --- a/examples/flowbasic +++ b/examples/flowbasic @@ -8,7 +8,7 @@ Note that request and response messages are not automatically replied to, so we need to implement handlers to do this. """ -from mitmproxy import flow, controller +from mitmproxy import flow, controller, options from mitmproxy.proxy import ProxyServer, ProxyConfig @@ -21,21 +21,23 @@ class MyMaster(flow.FlowMaster): @controller.handler def request(self, f): - f = flow.FlowMaster.request(self, f) - print(f) + print("request", f) @controller.handler def response(self, f): - f = flow.FlowMaster.response(self, f) - print(f) + print("response", f) + @controller.handler + def error(self, f): + print("error", f) + + @controller.handler + def log(self, f): + print("log", f) -config = ProxyConfig( - port=8080, - # use ~/.mitmproxy/mitmproxy-ca.pem as default CA file. - cadir="~/.mitmproxy/" -) +opts = options.Options(cadir="~/.mitmproxy/") +config = ProxyConfig(opts) state = flow.State() server = ProxyServer(config) -m = MyMaster(server, state) +m = MyMaster(opts, server, state) m.run() |