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

Function add

mitmproxy/contentviews/__init__.py:161–175  ·  view source on GitHub ↗

Register a contentview for use in mitmproxy. You may pass a `Contentview` instance or the class itself. When passing the class, its constructor will be invoked with no arguments.

(contentview: Contentview | type[Contentview])

Source from the content-addressed store, hash-verified

159
160
161def add(contentview: Contentview | type[Contentview]) -> None:
162 """
163 Register a contentview for use in mitmproxy.
164
165 You may pass a `Contentview` instance or the class itself.
166 When passing the class, its constructor will be invoked with no arguments.
167 """
168 if isinstance(contentview, View):
169 warnings.warn(
170 f"`mitmproxy.contentviews.View` is deprecated since mitmproxy 12, "
171 f"migrate {contentview.__class__.__name__} to `mitmproxy.contentviews.Contentview` instead.",
172 stacklevel=2,
173 )
174 contentview = LegacyContentview(contentview)
175 registry.register(contentview)
176
177
178# hack: docstring where pdoc finds it.

Callers

nothing calls this directly

Calls 3

LegacyContentviewClass · 0.85
warnMethod · 0.80
registerMethod · 0.45

Tested by

no test coverage detected