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])
| 159 | |
| 160 | |
| 161 | def 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. |
nothing calls this directly
no test coverage detected