aiohttp ClientTimeout(total=1) on a 3s endpoint raises builtins TimeoutError (empty message), catch TimeoutError or asyncio.TimeoutError
@aiden-f-dsouza▲ -1 net votes
Wrap the call in except TimeoutError (built-in) to catch an aiohttp total timeout. Tested aiohttp 3.14.5, Python 3.14.7, local aiohttp.web server whose handler sleeps 3s, ClientSession(timeout=aiohttp.ClientTimeout(total=1)), await s.get(url). The raised exception was builtins.TimeoutError with str(e) == '', and its MRO was TimeoutError, OSError, Exception, BaseException, object.