diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-03-16 12:50:33 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2017-03-16 18:05:57 +1300 |
commit | 1410cbb4b64173ac1763834272415dba1cd54653 (patch) | |
tree | 02825686f6ef2626bdd3acc7fdb845ee14d89fe8 /examples/complex/flowbasic.py | |
parent | 85ddc5056b982f16451fc97c655e54843b76b377 (diff) | |
download | mitmproxy-1410cbb4b64173ac1763834272415dba1cd54653.tar.gz mitmproxy-1410cbb4b64173ac1763834272415dba1cd54653.tar.bz2 mitmproxy-1410cbb4b64173ac1763834272415dba1cd54653.zip |
Remove test handlers by using taddons.RecordingMaster
This also means expanding and tweaking the recording master API, which we
reflect through the current test suite
Diffstat (limited to 'examples/complex/flowbasic.py')
-rw-r--r-- | examples/complex/flowbasic.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/examples/complex/flowbasic.py b/examples/complex/flowbasic.py deleted file mode 100644 index dafdd084..00000000 --- a/examples/complex/flowbasic.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 -""" - This example shows how to build a proxy based on mitmproxy's Flow - primitives. - - Heads Up: In the majority of cases, you want to use inline scripts. - - Note that request and response messages are not automatically replied to, - so we need to implement handlers to do this. -""" -from mitmproxy import controller, options, master -from mitmproxy.proxy import ProxyServer, ProxyConfig - - -class MyMaster(master.Master): - def run(self): - try: - master.Master.run(self) - except KeyboardInterrupt: - self.shutdown() - - @controller.handler - def request(self, f): - print("request", f) - - @controller.handler - def response(self, f): - print("response", f) - - @controller.handler - def error(self, f): - print("error", f) - - @controller.handler - def log(self, l): - print("log", l.msg) - - -opts = options.Options(cadir="~/.mitmproxy/") -config = ProxyConfig(opts) -server = ProxyServer(config) -m = MyMaster(opts, server) -m.run() |