mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Avoid explicitly passing the loop to asyncio
This behaviour is deprecated and will be removed in future versions of Python. Technically, it could be considered a bug (invalid usage causing different behaviour from the expected one), and in practice it should not break much code (because .get_event_loop() would likely be the same event loop anyway).
This commit is contained in:
@@ -341,8 +341,8 @@ class App(tkinter.Tk):
|
||||
self.chat.configure(bg='yellow')
|
||||
|
||||
|
||||
async def main(loop, interval=0.05):
|
||||
client = TelegramClient(SESSION, API_ID, API_HASH, loop=loop)
|
||||
async def main(interval=0.05):
|
||||
client = TelegramClient(SESSION, API_ID, API_HASH)
|
||||
try:
|
||||
await client.connect()
|
||||
except Exception as e:
|
||||
@@ -372,7 +372,7 @@ if __name__ == "__main__":
|
||||
# Some boilerplate code to set up the main method
|
||||
aio_loop = asyncio.get_event_loop()
|
||||
try:
|
||||
aio_loop.run_until_complete(main(aio_loop))
|
||||
aio_loop.run_until_complete(main())
|
||||
finally:
|
||||
if not aio_loop.is_closed():
|
||||
aio_loop.close()
|
||||
|
Reference in New Issue
Block a user