MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / make_har

Method make_har

mitmproxy/addons/savehar.py:49–76  ·  view source on GitHub ↗
(self, flows: Sequence[flow.Flow])

Source from the content-addressed store, hash-verified

47 logging.log(ALERT, f"HAR file saved ({human.pretty_size(len(har))} bytes).")
48
49 def make_har(self, flows: Sequence[flow.Flow]) -> dict:
50 entries = []
51 skipped = 0
52 # A list of server seen till now is maintained so we can avoid
53 # using 'connect' time for entries that use an existing connection.
54 servers_seen: set[Server] = set()
55
56 for f in flows:
57 if isinstance(f, http.HTTPFlow):
58 entries.append(self.flow_entry(f, servers_seen))
59 else:
60 skipped += 1
61
62 if skipped > 0:
63 logger.info(f"Skipped {skipped} flows that weren't HTTP flows.")
64
65 return {
66 "log": {
67 "version": "1.2",
68 "creator": {
69 "name": "mitmproxy",
70 "version": version.VERSION,
71 "comment": "",
72 },
73 "pages": [],
74 "entries": entries,
75 }
76 }
77
78 def load(self, loader: Loader):
79 loader.add_option(

Callers 4

export_harMethod · 0.95
doneMethod · 0.95
test_binary_contentFunction · 0.80
test_content_raisesFunction · 0.80

Calls 4

flow_entryMethod · 0.95
setFunction · 0.85
infoMethod · 0.80
appendMethod · 0.45

Tested by 2

test_binary_contentFunction · 0.64
test_content_raisesFunction · 0.64