aboutsummaryrefslogtreecommitdiffstats
path: root/examples/flowwriter.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-07-08 20:11:12 -0700
committerGitHub <noreply@github.com>2016-07-08 20:11:12 -0700
commit15c10d49f6b020c5b913ae5b5e8c4b923a507a47 (patch)
treeb13eb4f3ec88fa90b515edcf4323363124dcd995 /examples/flowwriter.py
parentf7639e077ab10dc8e7f180f44b531b9ad35c060b (diff)
parent5d2b7c52f9c33e84be5c4330b09b0f2a5ad869e2 (diff)
downloadmitmproxy-15c10d49f6b020c5b913ae5b5e8c4b923a507a47.tar.gz
mitmproxy-15c10d49f6b020c5b913ae5b5e8c4b923a507a47.tar.bz2
mitmproxy-15c10d49f6b020c5b913ae5b5e8c4b923a507a47.zip
Merge pull request #1327 from mitmproxy/remove-script-context
Remove script context
Diffstat (limited to 'examples/flowwriter.py')
-rw-r--r--examples/flowwriter.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/flowwriter.py b/examples/flowwriter.py
index cb5ccb0d..07c7ca20 100644
--- a/examples/flowwriter.py
+++ b/examples/flowwriter.py
@@ -3,8 +3,10 @@ import sys
from mitmproxy.flow import FlowWriter
+state = {}
-def start(context):
+
+def start():
if len(sys.argv) != 2:
raise ValueError('Usage: -s "flowriter.py filename"')
@@ -12,9 +14,9 @@ def start(context):
f = sys.stdout
else:
f = open(sys.argv[1], "wb")
- context.flow_writer = FlowWriter(f)
+ state["flow_writer"] = FlowWriter(f)
-def response(context, flow):
+def response(flow):
if random.choice([True, False]):
- context.flow_writer.add(flow)
+ state["flow_writer"].add(flow)