'Client sample code from aiohttp docs is complaining about missing connector

I am trying to run the below aiohttp client sample code straight out of aiohttp docs but it is throwing an exception.

import aiohttp
import asyncio

async def main():

    async with aiohttp.ClientSession() as session:
        async with session.get('http://python.org') as response:

            print("Status:", response.status)
            print("Content-type:", response.headers['content-type'])

            html = await response.text()
            print("Body:", html[:15], "...")

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Exception

Traceback (most recent call last):
  File "aiohttp-test.py", line 16, in <module>
    loop.run_until_complete(main())
  File "/Users/waseem/.pyenv/versions/3.8.4/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "aiohttp-test.py", line 6, in main
    async with aiohttp.ClientSession() as session:
TypeError: __init__() missing 1 required positional argument: 'connector'

Versions of the required libs installed

enter image description here

Does anyone know what could be happening here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source