From 456f80d862b1eb1a268f9780eac77c11c227ce81 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Mon, 8 Aug 2016 14:33:21 +0530 Subject: Open JSON file in text mode --- examples/har_dump.py | 2 +- test/mitmproxy/test_examples.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/har_dump.py b/examples/har_dump.py index 819c38d8..5acd8bfa 100644 --- a/examples/har_dump.py +++ b/examples/har_dump.py @@ -120,7 +120,7 @@ def done(): mitmproxy.ctx.log(pprint.pformat(HAR)) # TODO: .zhar compression else: - with open(dump_file, "wb") as f: + with open(dump_file, "w") as f: f.write(json.dumps(HAR, indent=2)) # TODO: Log results via mitmproxy.ctx.log diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py index 78681c4e..62e6a652 100644 --- a/test/mitmproxy/test_examples.py +++ b/test/mitmproxy/test_examples.py @@ -128,7 +128,7 @@ class TestHARDump(mastertest.MasterTest): self.invoke(m, "response", self.req_get) m.addons.remove(sc) - with open(path, "rb") as inp: + with open(path, "r") as inp: har = json.load(inp) assert len(har["log"]["entries"]) == 1 -- cgit v1.2.3