Client-side communication with aiohttp

In previous sections, we covered examples of implementing asynchronous communication channels with the asyncio module, mostly from the perspective of the server side of the communication process. In other words, we have been considering handling and processing requests sent from external systems. This, however, is only one side of the equation, and we also have the client side of communication to explore. In this section, we will discuss applying asynchronous programming to make requests to servers.

As you have most likely guessed, the end goal of this process is to efficiently collect data from external systems by asynchronously making requests to those systems. We will be revisiting the concept of web scraping, which is the process of automating HTTP requests to various websites and extracting specific information from their HTML source code. If you have not read Chapter 5, Concurrent Web Requests, I highly recommend going through it before proceeding with this section, as that chapter covers the foundational ideas of web scraping, and other relevant, important concepts.

In this section, you will also be introduced to another module that supports asynchronous programming options: aiohttp (which stands for Asynchronous I/O HTTP). This module provides high-level functionalities that streamline HTTP communication procedures, and it also works seamlessly with the asyncio module, in order to facilitate asynchronous programming.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.78.237