mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-17 21:22:40 +00:00
Add support for "async with" context manager
This commit is contained in:
parent
a329e56259
commit
a06885dd14
@ -243,6 +243,12 @@ class Client(Methods, BaseClient):
|
|||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
self.stop()
|
self.stop()
|
||||||
|
|
||||||
|
async def __aenter__(self):
|
||||||
|
return await self.start()
|
||||||
|
|
||||||
|
async def __aexit__(self, *args):
|
||||||
|
await self.stop()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def proxy(self):
|
def proxy(self):
|
||||||
return self._proxy
|
return self._proxy
|
||||||
|
Loading…
Reference in New Issue
Block a user