Skip to content

Commit

Permalink
async with
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherry committed Nov 13, 2024
1 parent ea4875b commit d861c2f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions livekit-api/livekit/api/livekit_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,15 @@ async def aclose(self):
Call this before your application exits or when the API client is no longer needed."""
await self._session.close()

async def __aenter__(self):
"""@private
Support for `async with`"""
return self

async def __aexit__(self, exc_type, exc_val, exc_tb):
"""@private
Support for `async with`"""
await self.aclose()

0 comments on commit d861c2f

Please sign in to comment.