Total Complexity | 2 |
Total Lines | 18 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import aiohttp |
||
2 | from aiohttp import web |
||
3 | |||
4 | import aiohttp_rpc |
||
5 | |||
6 | |||
7 | async def make_client(aiohttp_client, rpc_server: aiohttp_rpc.JsonRpcServer) -> aiohttp.ClientSession: |
||
8 | app = web.Application() |
||
9 | app.router.add_post('/rpc', rpc_server.handle_http_request) |
||
10 | return await aiohttp_client(app) |
||
11 | |||
12 | |||
13 | async def make_ws_client(aiohttp_client, rpc_server: aiohttp_rpc.WsJsonRpcServer) -> aiohttp.ClientSession: |
||
14 | app = web.Application() |
||
15 | app.router.add_get('/rpc', rpc_server.handle_http_request) |
||
16 | app.on_shutdown.append(rpc_server.on_shutdown) |
||
17 | return await aiohttp_client(app) |
||
18 |