Open ir4y opened 1 year ago
class AsyncFHIRClient: ... @classmethod async def attach( cls: type["AsyncFHIRClient"], app: aiohttp.web_app.Application ) -> AsyncGenerator: session = aiohttp.ClientSession() client = cls(session=session) app[cls.key] = client yield await session.close() ...
app = web.Application() app.cleanup_ctx.append(AsyncFHIRClient.attach)
def create_app(sdk: SDK): app = web.Application() app.cleanup_ctx.append(AidboxClient.attach) app.cleanup_ctx.append(init) app.update( settings=sdk.settings, sdk=sdk, ) setup_routes(app) return app
Related #93