comparison examples/_run_server_child.py @ 10:52e1bb1532f2

serve_inline_graph
author drewp@bigasterisk.com
date Sat, 16 Mar 2024 16:02:23 -0700
parents 25538e3ee531
children 0bc06da6bf74
comparison
equal deleted inserted replaced
9:b72f4ba1345d 10:52e1bb1532f2
18 async def __aexit__(self, exc_type, exc, tb): 18 async def __aexit__(self, exc_type, exc, tb):
19 await self._session.close() 19 await self._session.close()
20 self.subprocess.terminate() 20 self.subprocess.terminate()
21 await self.subprocess.wait() 21 await self.subprocess.wait()
22 22
23 async def get(self, url: str) -> aiohttp.ClientResponse: 23 async def get(self, url: str, headers=None) -> aiohttp.ClientResponse:
24 while True: 24 while True:
25 try: 25 try:
26 return await self._session.get(url) 26 return await self._session.get(url, headers=headers)
27 except aiohttp.ClientConnectorError: 27 except aiohttp.ClientConnectorError:
28 await asyncio.sleep(0.05) 28 await asyncio.sleep(0.05)