From ef2e238335cf88b3c1247309d166e9135c242e6d Mon Sep 17 00:00:00 2001 From: aviau Date: Sun, 18 Aug 2024 16:14:27 -0400 Subject: [PATCH] api_client: check netloc using urlparse --- flareio/api_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flareio/api_client.py b/flareio/api_client.py index 62a4c2f..7c3f0aa 100644 --- a/flareio/api_client.py +++ b/flareio/api_client.py @@ -3,6 +3,7 @@ from datetime import datetime from datetime import timedelta from flareio.exceptions import TokenError +from urllib.parse import urlparse import typing as t @@ -66,7 +67,7 @@ def _request( json: t.Optional[t.Dict[str, t.Any]] = None, headers: t.Optional[t.Dict[str, t.Any]] = None, ) -> requests.Response: - if not url.startswith("https://api.flare.io"): + if not urlparse(url).netloc == "api.flare.io": raise Exception( "Please only use the client to access the api.flare.io domain." )