diff options
Diffstat (limited to 'examples/complex')
-rw-r--r-- | examples/complex/nonblocking.py | 7 | ||||
-rw-r--r-- | examples/complex/websocket_inject_message.py | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/examples/complex/nonblocking.py b/examples/complex/nonblocking.py index 72c9c0ab..dd74aec0 100644 --- a/examples/complex/nonblocking.py +++ b/examples/complex/nonblocking.py @@ -1,12 +1,11 @@ import time from mitmproxy.script import concurrent -from mitmproxy import ctx @concurrent # Remove this and see what happens def request(flow): - # You don't want to use mitmproxy.ctx from a different thread - ctx.log.info("handle request: %s%s" % (flow.request.host, flow.request.path)) + # This is ugly in mitmproxy's UI, but you don't want to use mitmproxy.ctx.log from a different thread. + print("handle request: %s%s" % (flow.request.host, flow.request.path)) time.sleep(5) - ctx.log.info("start request: %s%s" % (flow.request.host, flow.request.path)) + print("start request: %s%s" % (flow.request.host, flow.request.path)) diff --git a/examples/complex/websocket_inject_message.py b/examples/complex/websocket_inject_message.py index e9c3ea0c..38be5555 100644 --- a/examples/complex/websocket_inject_message.py +++ b/examples/complex/websocket_inject_message.py @@ -13,7 +13,7 @@ class InjectWebSocketMessage: i = 0 while not flow.ended and not flow.error: await asyncio.sleep(5) - flow.inject_message(flow.client_conn, 'This is the #{} an injected message!'.format(i)) + flow.inject_message(flow.client_conn, 'This is the #{} injected message!'.format(i)) i += 1 def websocket_start(self, flow): |