diff options
Diffstat (limited to 'examples/simple/websocket_messages.py')
-rw-r--r-- | examples/simple/websocket_messages.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/simple/websocket_messages.py b/examples/simple/websocket_messages.py new file mode 100644 index 00000000..719e7b10 --- /dev/null +++ b/examples/simple/websocket_messages.py @@ -0,0 +1,13 @@ +import re +from mitmproxy import ctx + + +def websocket_message(flow): + # get the latest message + message = flow.messages[-1] + + # simply print the content of the message + ctx.log.info(message.content) + + # manipulate the message content + message.content = re.sub(r'^Hello', 'HAPPY', message.content) |