The aiohttp library enables developers to make asynchronous HTTP requests in Python. It is a powerful tool for building asynchronous web applications and scraping websites.
To get started with aiohttp, the first step is to install it.
Installation
aiohttp can be installed via pip, Python's package manager:
pip install aiohttp
This will download and install the latest stable release of aiohttp.
For the bleeding edge development version, install directly from GitHub:
pip install git+https://github.com/aio-libs/aiohttp
I recommend installing aiohttp inside a virtual environment to avoid conflicting with other Python packages.
Once installed, aiohttp can be imported in Python code:
import aiohttp
Version Considerations
The latest 3.x version of aiohttp requires Python 3.6 or higher.
For Python 3.5 support, install aiohttp 2.3.x:
pip install aiohttp==2.3.10
So check your Python version before installing aiohttp.
Next Steps
With aiohttp installed, you're ready to start making asynchronous HTTP requests.
Some things to try next:
The aiohttp documentation has many great examples to get you started.