From 23b9ef799eb0d322c7dcfe796b196cce3cea6435 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Tue, 9 Aug 2016 10:29:41 +0530 Subject: Add a ctx.log on finish --- examples/har_dump.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/har_dump.py') 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): -- cgit v1.2.3