diff --git a/flareio/api_client.py b/flareio/api_client.py index 7842921..9b6d530 100644 --- a/flareio/api_client.py +++ b/flareio/api_client.py @@ -103,14 +103,17 @@ def _request( ) -> requests.Response: url = urljoin("https://api.flare.io", url) - if not urlparse(url).netloc == "api.flare.io": + netloc: str = urlparse(url).netloc + if not netloc == "api.flare.io": raise Exception( - "Please only use the client to access the api.flare.io domain." + f"You tried to use the client to access the {netloc} domain. Only api.flare.io is supported." ) + headers = { **(headers or {}), **self._auth_headers(), } + return self._session.request( method=method, url=url, diff --git a/tests/test_api_client_endpoints.py b/tests/test_api_client_endpoints.py index a45bcad..75d3513 100644 --- a/tests/test_api_client_endpoints.py +++ b/tests/test_api_client_endpoints.py @@ -87,6 +87,6 @@ def test_bad_domain() -> None: with pytest.raises( Exception, - match="Please only use the client to access the api.flare.io domain.", + match="You tried to use the client to access the bad.com domain. Only api.flare.io is supported.", ): client.post("https://bad.com/hello-post")