<filename>connect_default.py
import asyncio
from nats.aio.client import Client as NATS

async def example():
   # [begin connect_default]
   nc = NATS()
   await nc.connect()

   # Do something with the connection

   await nc.close()

   # [end connect_default]

loop = asyncio.get_event_loop()
loop.run_until_complete(example())
loop.close()

<filename>connect_default.py
import asyncio
from nats.aio.client import Client as NATS

async def example():
   # [begin connect_default]
   nc = NATS()
   await nc.connect()

   # Do something with the connection

   await nc.close()

   # [end connect_default]

loop = asyncio.get_event_loop()
loop.run_until_complete(example())
loop.close()

# [begin connect_default] # Do something with the connection # [end connect_default]