aboutsummaryrefslogtreecommitdiffstats
path: root/examples/flowwriter.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-07-07 18:37:33 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-07-07 20:14:52 -0700
commitc048ae1d5b652ad4778917e624ace217e1ecfd91 (patch)
tree1c650c871df749f8e77d70e74366ebe599d7e0b4 /examples/flowwriter.py
parent7a5b21556b7c707ed3da8d6fa3ece8119ea38630 (diff)
downloadmitmproxy-c048ae1d5b652ad4778917e624ace217e1ecfd91.tar.gz
mitmproxy-c048ae1d5b652ad4778917e624ace217e1ecfd91.tar.bz2
mitmproxy-c048ae1d5b652ad4778917e624ace217e1ecfd91.zip
remove context from all scripts
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)