![]() |
Aiohttp library in Python is an asynchronous HTTP client and server framework that is built on top of the asynchronous I/O library asyncio in Python. Using this library, we can build web applications and RESTful APIs, and also we can handle synchronous HTTP requests in the application. This library has the support for middleware for mainly intercepting and also for modifying requests and responses. In this article, we will see two different methods to install the Aiohttp library in Python. Pre Requisites Here are some prerequisites to installing the Aiohttp in Python. How To Install Aiohttp In Python?Method 1: Install Aiohttp using PIPFirst, open the command prompt with the administrative user on your system and execute the below command in the prompt to install aiohttp using PIP. pip3 install aiohttp
Once the installation is completed, our next task is to verify the successful installation. So we can verify it by checking the information about the library. Execute the below command in the prompt to verify. pip3 show aiohttp
Output: Method 2: Install Aiohttp Using CondaWe can also install the library by using Conda. So to install the Aiohttp using conda, execute the below command in the terminal. conda install -c conda-forge aiohttp
This will ask for confirmation, where we need to provide ‘y’ to confirm the installation. To verify that aiohttp was successfully installed on the system with conda, run a command in the command window. conda list aiohttp
Output: Check ‘aiohttp’ is Imported using CodeIn this example, we define an asynchronous function Python3
Run the Server : python scripts_name.py
Output: ConclusionInstalling Aiohttp in Python is a straightforward process, achieved through the use of the |
Reffered: https://www.geeksforgeeks.org
Python |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |