From 5a6844e0e4067ad71766460240befc61ad94ede5 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Wed, 15 Aug 2018 15:31:28 -0400 Subject: [PATCH] update asyncio.async() instances to asyncio.ensure_future() --- hangups_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hangups_client.py b/hangups_client.py index 9191245..fba29f9 100755 --- a/hangups_client.py +++ b/hangups_client.py @@ -69,7 +69,7 @@ def run_example(example_coroutine, *extra_args): while 1: print("Attempting main loop...") client = hangups.Client(cookies, max_retries=float('inf'), retry_backoff_base=1.2) - task = asyncio.async(_async_main(example_coroutine, client, args)) + task = asyncio.ensure_future(_async_main(example_coroutine, client, args)) loop = asyncio.get_event_loop() try: @@ -116,7 +116,7 @@ def _get_parser(): def _async_main(example_coroutine, client, args): """Run the example coroutine.""" # Spawn a task for hangups to run in parallel with the example coroutine. - task = asyncio.async(client.connect()) + task = asyncio.ensure_future(client.connect()) # Wait for hangups to either finish connecting or raise an exception. on_connect = asyncio.Future() @@ -237,7 +237,7 @@ def listen_events(client, _): if msgJson['cmd'] == 'sendmessage': segments = hangups.ChatMessageSegment.from_str(msgJson['msgbody']) - asyncio.async( + asyncio.ensure_future( conv.send_message(segments) ).add_done_callback(_on_message_sent) else: