From e4afb33e7924ef224ffb0111d3e878aacdc6c881 Mon Sep 17 00:00:00 2001 From: Allisson Azevedo Date: Thu, 28 May 2020 11:39:05 -0300 Subject: [PATCH] Fix httpx exception imports on httpx 0.13.x --- CHANGES.rst | 5 +++++ requirements.txt | 2 +- setup.py | 2 +- simple_rest_client/decorators.py | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 9ed5986..f25d398 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,11 @@ Changelog --------- +1.0.6 +~~~~~ + +* Fix httpx exception imports on httpx 0.13.x (thanks @denravonska). + 1.0.5 ~~~~~ diff --git a/requirements.txt b/requirements.txt index 502a2bb..e94325e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -httpx>=0.12.1 +httpx>=0.13.2 python-slugify>=4.0.0 python-status>=1.0.1 diff --git a/setup.py b/setup.py index 1374fa4..71ae707 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ changelog = f.read() -install_requirements = ["python-status>=1.0.1", "httpx>=0.12.1", "python-slugify>=4.0.0"] +install_requirements = ["python-status>=1.0.1", "httpx>=0.13.2", "python-slugify>=4.0.0"] tests_requirements = ["pytest", "pytest-asyncio", "pytest-cov", "pytest-httpserver", "coveralls"] diff --git a/simple_rest_client/decorators.py b/simple_rest_client/decorators.py index f74e9c9..e66b45b 100644 --- a/simple_rest_client/decorators.py +++ b/simple_rest_client/decorators.py @@ -26,7 +26,7 @@ def handle_request_error(f): def wrapper(*args, **kwargs): try: response = f(*args, **kwargs) - except (httpx.TimeoutException,) as exc: + except (httpx.ConnectTimeout, httpx.ReadTimeout, httpx.WriteTimeout, httpx.PoolTimeout) as exc: logger.exception(exc) raise ClientConnectionError() from exc @@ -41,7 +41,7 @@ def handle_async_request_error(f): async def wrapper(*args, **kwargs): try: response = await f(*args, **kwargs) - except (httpx.TimeoutException,) as exc: + except (httpx.ConnectTimeout, httpx.ReadTimeout, httpx.WriteTimeout, httpx.PoolTimeout) as exc: logger.exception(exc) raise ClientConnectionError() from exc