Comparison Between Fast HTTP Clients
Understand how various HTTP client approaches affect speed and scalability when building REST APIs in Python. Learn to use sessions for connection reuse, threads for parallel requests, and discover why aiohttp is the preferred choice for asynchronous and high-performance HTTP clients.
We'll cover the following...
We'll cover the following...
serialized vs. sessions vs. aiohttp
All HTTP client solutions (using sessions, threads, futures or asyncio) offer different approaches to making HTTP clients faster.
The following example is an HTTP client sending requests to httpbin.org, an HTTP API that provides (among other things) an endpoint simulating a long request (a second here). This example implements all the techniques listed above and times them.
To run the following application, click Run and enter command
python...