diff --git a/README.md b/README.md index 01ddbcd..476bb35 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,13 @@ and swap the HTTP client while inheriting everything else. `requirements.txt`: ``` -aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.2 +aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.3 ``` Direct: ```bash -pip install "aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.2" +pip install "aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.3" ``` Requires `aiohttp` and `yarl` (pulled transitively). diff --git a/pyproject.toml b/pyproject.toml index fbdaae1..b29df7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "aioweb" -version = "0.1.2" +version = "0.1.3" description = "Async HTTP session wrapper over aiohttp — proxies, header overwrites, retries, previews. Config-free, installable." requires-python = ">=3.10" dependencies = [ diff --git a/src/aioweb/session.py b/src/aioweb/session.py index 91ea3b8..70c0f8c 100644 --- a/src/aioweb/session.py +++ b/src/aioweb/session.py @@ -17,6 +17,7 @@ sessions must be closed explicitly (async with, or await s.close()); there is no __del__ auto-close (that pattern is unsafe for async resources). """ +import asyncio import logging import warnings @@ -312,7 +313,10 @@ class ExtendedSession: if debug and result.redirect_chain: log.info("redirect chain: %s", result.redirect_chain) return result - except aiohttp.ClientError as error: + except (aiohttp.ClientError, asyncio.TimeoutError) as error: + # a total ClientTimeout raises a bare asyncio.TimeoutError, which is NOT an + # aiohttp.ClientError subclass — wrap it into the same typed path so direct + # callers get a consistent failure instead of a raw timeout raise aiohttp.ClientError(f"client error for {url}: {error}") from error async def request_with_retries(