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

Method to_json

mitmproxy/dns.py:171–182  ·  view source on GitHub ↗

Converts the resource record into json for mitmweb. Sync with web/src/flow.ts.

(self)

Source from the content-addressed store, hash-verified

169 return f"0x{self.data.hex()} (invalid {types.to_str(self.type)} data)"
170
171 def to_json(self) -> dict[str, str | int | HTTPSRecordJSON]:
172 """
173 Converts the resource record into json for mitmweb.
174 Sync with web/src/flow.ts.
175 """
176 return {
177 "name": self.name,
178 "type": types.to_str(self.type),
179 "class": classes.to_str(self.class_),
180 "ttl": self.ttl,
181 "data": self._data_json(),
182 }
183
184 @classmethod
185 def from_json(cls, data: dict[str, Any]) -> Self:

Callers

nothing calls this directly

Calls 1

_data_jsonMethod · 0.95

Tested by

no test coverage detected