Add support for "async with" context manager

This commit is contained in:
Dan 2019-03-16 19:56:25 +01:00
parent a329e56259
commit a06885dd14

View File

@ -243,6 +243,12 @@ class Client(Methods, BaseClient):
def __exit__(self, *args):
self.stop()
async def __aenter__(self):
return await self.start()
async def __aexit__(self, *args):
await self.stop()
@property
def proxy(self):
return self._proxy