aboutsummaryrefslogtreecommitdiffstats
path: root/examples/complex/flowbasic.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-03-16 14:57:26 +0100
committerGitHub <noreply@github.com>2017-03-16 14:57:26 +0100
commit6d66184ebacbfa81759d61ac691cd91ffda616fc (patch)
tree4fd7c0d0227a1874fcf1580098ed6a00faf451cf /examples/complex/flowbasic.py
parent50eeac482f9c9c538117968c12516d3c8bb60dc0 (diff)
parentc5e0dc64b9b367eae8f4af66a4917c738dd87569 (diff)
downloadmitmproxy-6d66184ebacbfa81759d61ac691cd91ffda616fc.tar.gz
mitmproxy-6d66184ebacbfa81759d61ac691cd91ffda616fc.tar.bz2
mitmproxy-6d66184ebacbfa81759d61ac691cd91ffda616fc.zip
Merge pull request #2168 from cortesi/handlers
Rip out old handlers mechanism - all events are now handled in addons
Diffstat (limited to 'examples/complex/flowbasic.py')
-rw-r--r--examples/complex/flowbasic.py43
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()