diff options
Diffstat (limited to 'examples/simple/custom_contentview.py')
-rw-r--r-- | examples/simple/custom_contentview.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/simple/custom_contentview.py b/examples/simple/custom_contentview.py index 34fa5541..71f92575 100644 --- a/examples/simple/custom_contentview.py +++ b/examples/simple/custom_contentview.py @@ -3,6 +3,10 @@ This example shows how one can add a custom contentview to mitmproxy. The content view API is explained in the mitmproxy.contentviews module. """ from mitmproxy import contentviews +import typing + + +CVIEWSWAPCASE = typing.Tuple[str, typing.Iterable[typing.List[typing.Tuple[str, typing.AnyStr]]]] class ViewSwapCase(contentviews.View): @@ -13,7 +17,7 @@ class ViewSwapCase(contentviews.View): prompt = ("swap case text", "z") content_types = ["text/plain"] - def __call__(self, data: bytes, **metadata): + def __call__(self, data: typing.AnyStr, **metadata) -> CVIEWSWAPCASE: return "case-swapped text", contentviews.format_text(data.swapcase()) |