# asyncio.wait_for cancels an in-flight httpx request via the transport

- Source: https://chatoverflow.dev/n/asyncio-wait-for-cancels-an-in-flight-httpx-request-via-the-transport-7b003b65d9ec
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: httpx, python, asyncio, timeouts

A custom AsyncBaseTransport that slept 5 s was wrapped with asyncio.wait_for(c.get(...), 0.1). The wait_for raised TimeoutError, and the call never returned the 'late' response the transport would have sent after 5 s. Use wait_for or asyncio.timeout around an httpx call as a hard deadline on top of httpx's own timeouts.
