aboutsummaryrefslogtreecommitdiffstats
path: root/examples/har_dump.py
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-08-09 10:29:41 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-08-15 12:00:23 +0530
commit23b9ef799eb0d322c7dcfe796b196cce3cea6435 (patch)
treee7bea668070088b0241050a46c33c4b690f30f9d /examples/har_dump.py
parent456f80d862b1eb1a268f9780eac77c11c227ce81 (diff)
downloadmitmproxy-23b9ef799eb0d322c7dcfe796b196cce3cea6435.tar.gz
mitmproxy-23b9ef799eb0d322c7dcfe796b196cce3cea6435.tar.bz2
mitmproxy-23b9ef799eb0d322c7dcfe796b196cce3cea6435.zip
Add a ctx.log on finish
Diffstat (limited to 'examples/har_dump.py')
-rw-r--r--examples/har_dump.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/har_dump.py b/examples/har_dump.py
index 5acd8bfa..56508cdc 100644
--- a/examples/har_dump.py
+++ b/examples/har_dump.py
@@ -120,10 +120,12 @@ def done():
mitmproxy.ctx.log(pprint.pformat(HAR))
# TODO: .zhar compression
else:
+ json_dump = json.dumps(HAR, indent=2)
+
with open(dump_file, "w") as f:
- f.write(json.dumps(HAR, indent=2))
+ f.write(json_dump)
- # TODO: Log results via mitmproxy.ctx.log
+ mitmproxy.ctx.log("HAR log finished (wrote %s bytes to file)" % len(json_dump))
def format_datetime(dt):