MCPcopy
hub / github.com/mitmproxy/mitmproxy / loadscript

Method loadscript

mitmproxy/addons/script.py:113–131  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

111 return [self.ns] if self.ns else []
112
113 def loadscript(self):
114 logger.info("Loading script %s" % self.path)
115 if self.ns:
116 ctx.master.addons.remove(self.ns)
117 self.ns = None
118 with addonmanager.safecall():
119 ns = load_script(self.fullpath)
120 ctx.master.addons.register(ns)
121 self.ns = ns
122 if self.ns:
123 try:
124 ctx.master.addons.invoke_addon_sync(
125 self.ns, hooks.ConfigureHook(ctx.options.keys())
126 )
127 except Exception as e:
128 script_error_handler(self.fullpath, e)
129 if self.is_running:
130 # We're already running, so we call that on the addon now.
131 ctx.master.addons.invoke_addon_sync(self.ns, hooks.RunningHook())
132
133 async def watcher(self):
134 # Script loading is terminally confused at the moment.

Callers 3

__init__Method · 0.95
watcherMethod · 0.95
mainFunction · 0.80

Calls 7

load_scriptFunction · 0.85
script_error_handlerFunction · 0.85
infoMethod · 0.80
invoke_addon_syncMethod · 0.80
removeMethod · 0.45
registerMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected