From a3c209aefe83f6c69392840af96e16972fa46369 Mon Sep 17 00:00:00 2001 From: jnicoulaud-ledger <102984500+jnicoulaud-ledger@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:07:59 +0100 Subject: [PATCH] fix: fix host substitution on HTTP client (#162) --- src/erc7730/common/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/erc7730/common/client.py b/src/erc7730/common/client.py index 449c279..bd33987 100644 --- a/src/erc7730/common/client.py +++ b/src/erc7730/common/client.py @@ -169,7 +169,7 @@ def handle_request(self, request: Request) -> Response: # substitute base URL if provided if (api_host := os.environ.get(self.ETHERSCAN_API_HOST)) is not None: - request.url = URL(str(request.url).replace(ETHERSCAN, api_host)) + request.url = request.url.copy_with(host=api_host) request.headers.update({"Host": api_host}) # add API key if provided