¶
Async HTTP for Python. Connections stay open. Your event loop stays free.
One client, many requests¶
Keep one Client for the work you are doing. The next request to the same server reuses the connection, so it does not pay for a new handshake.
import asyncio
from redc import Client
async def main():
async with Client(base_url="https://example.com") as client:
response = await client.get("/get")
response.raise_for_status()
print(response.status_code, response.first_byte_time)
asyncio.run(main())
HTTP/3 is the default. If the server does not offer it, the request uses HTTP/2 or HTTP/1.1. Certificates are checked with trustifi.