From 93f33afb7559e7a6a1d9707ab80f3d42e28d4869 Mon Sep 17 00:00:00 2001 From: CrazyProger1 Date: Mon, 29 Apr 2024 15:23:54 +0300 Subject: [PATCH] Fix: connect error text --- resty/clients/httpx/clients.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/resty/clients/httpx/clients.py b/resty/clients/httpx/clients.py index 148891c..e13a094 100644 --- a/resty/clients/httpx/clients.py +++ b/resty/clients/httpx/clients.py @@ -1,4 +1,5 @@ import json +from urllib.parse import urljoin import httpx @@ -20,10 +21,10 @@ class RESTClient(BaseRESTClient): def __init__( - self, - httpx_client: httpx.AsyncClient = None, - check_status: bool = True, - middleware_manager: BaseMiddlewareManager = None, + self, + httpx_client: httpx.AsyncClient = None, + check_status: bool = True, + middleware_manager: BaseMiddlewareManager = None, ): self.middlewares = middleware_manager or MiddlewareManager() self._xclient = httpx_client or httpx.AsyncClient() @@ -45,7 +46,7 @@ async def _make_xrequest(self, request: Request) -> httpx.Response: timeout=request.timeout, ) except httpx.ConnectError: - raise ConnectError(url=request.url) + raise ConnectError(url=urljoin(str(self._xclient.base_url), request.url)) @staticmethod def _extract_json_data(xresponse: httpx.Response) -> dict | list: @@ -57,7 +58,7 @@ def _extract_json_data(xresponse: httpx.Response) -> dict | list: return data async def _parse_xresponse( - self, request: Request, xresponse: httpx.Response + self, request: Request, xresponse: httpx.Response ) -> Response: return Response( request=request,