I can do time.sleep in before_upstream_connection. However, it only works flawlessly in threaded mode. In threadless mode it would block the entire event loop. I think the threadless mode is using asyncio, but I cannot tell how to do async sleep in threadless mode. Could you tell me how to implement it in the plugin?
Is there a decorator like mitmproxy.script.concurrent?