MCPcopy Index your code
hub / github.com/python-websockets/websockets / run_proxy

Method run_proxy

tests/proxy.py:84–112  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

82
83 @classmethod
84 async def run_proxy(cls):
85 cls.proxy_loop = loop = asyncio.get_event_loop()
86 cls.proxy_stop = stop = loop.create_future()
87
88 cls.proxy_options = options = Options(
89 mode=[cls.proxy_mode],
90 # Don't intercept connections, but record them.
91 ignore_hosts=["^localhost:", "^127.0.0.1:", "^::1:"],
92 # This option requires mitmproxy 11.0.0, which requires Python 3.11.
93 show_ignored_hosts=True,
94 )
95 cls.proxy_master = master = Master(options)
96 master.addons.add(
97 core.Core(),
98 proxyauth.ProxyAuth(),
99 proxyserver.Proxyserver(),
100 next_layer.NextLayer(),
101 tlsconfig.TlsConfig(),
102 RecordFlows(on_running=cls.proxy_ready.set),
103 AlterRequest(),
104 )
105
106 task = loop.create_task(cls.proxy_master.run())
107 await stop
108
109 for server in master.addons.get("proxyserver").servers:
110 await server.stop()
111 master.shutdown()
112 await task
113
114 @classmethod
115 def setUpClass(cls):

Callers 1

setUpClassMethod · 0.80

Calls 4

RecordFlowsClass · 0.85
AlterRequestClass · 0.85
getMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected