Skip to content

Commit

Permalink
api_client: check netloc using urlparse
Browse files Browse the repository at this point in the history
  • Loading branch information
aviau committed Aug 18, 2024
1 parent 0506d5d commit ef2e238
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flareio/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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."
)
Expand Down

0 comments on commit ef2e238

Please sign in to comment.