Skip to content

Commit

Permalink
Update to raise backwards-compat errors for invalid lat/lon
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed May 6, 2024
1 parent 6236217 commit 837fb9a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions neon_api_proxy/services/owm_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def handle_query(self, **kwargs) -> dict:

def _get_api_response(self, lat: str, lng: str, units: str,
api: str = "onecall", lang: str = "en") -> Response:
try:
assert isinstance(float(lat), float), f"Invalid latitude: {lat}"
assert isinstance(float(lng), float), f"Invalid longitude: {lng}"
except AssertionError as e:
raise ValueError(e)
if api != "onecall":
log_deprecation(f"{api} was requested but only `onecall` "
f"is supported", "1.0.0")
Expand Down

0 comments on commit 837fb9a

Please sign in to comment.