MCPcopy
hub / github.com/mitmproxy/mitmproxy / __init__

Method __init__

mitmproxy/master.py:27–52  ·  view source on GitHub ↗
(
        self,
        opts: options.Options | None,
        event_loop: asyncio.AbstractEventLoop | None = None,
        with_termlog: bool = False,
    )

Source from the content-addressed store, hash-verified

25 _termlog_addon: termlog.TermLog | None = None
26
27 def __init__(
28 self,
29 opts: options.Options | None,
30 event_loop: asyncio.AbstractEventLoop | None = None,
31 with_termlog: bool = False,
32 ):
33 self.options: options.Options = opts or options.Options()
34 self.commands = command.CommandManager(self)
35 self.addons = addonmanager.AddonManager(self)
36
37 if with_termlog:
38 self._termlog_addon = termlog.TermLog()
39 self.addons.add(self._termlog_addon)
40
41 self.log = log.Log(self) # deprecated, do not use.
42 self._legacy_log_events = log.LegacyLogEvents(self)
43 self._legacy_log_events.install()
44
45 # We expect an active event loop here already because some addons
46 # may want to spawn tasks during the initial configuration phase,
47 # which happens before run().
48 self.event_loop = event_loop or asyncio.get_running_loop()
49 self.should_exit = asyncio.Event()
50 mitmproxy_ctx.master = self
51 mitmproxy_ctx.log = self.log # deprecated, do not use.
52 mitmproxy_ctx.options = self.options
53
54 async def run(self) -> None:
55 with (

Callers

nothing calls this directly

Calls 2

installMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected