Skip to content

Commit

Permalink
Undo 'unit' kwarg handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel McKnight committed May 6, 2024
1 parent a0fe428 commit 7a76127
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions neon_api_proxy/services/owm_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def handle_query(self, **kwargs) -> dict:
lng = kwargs.get("lng", kwargs.get("lon"))
api = kwargs.get('api') or "onecall"
lang = kwargs.get('lang') or "en"
units = "metric" if kwargs.get("units", kwargs.get("unit")) == "metric" else "imperial"
units = "metric" if kwargs.get("units") == "metric" else "imperial"

if not all((lat, lng, units)):
return {"status_code": -1,
Expand All @@ -88,7 +88,7 @@ def _get_api_response(self, lat: str, lng: str, units: str,
except AssertionError as e:
raise ValueError(e)
if api != "onecall":
log_deprecation(f"`{api}` was requested but only `onecall` "
log_deprecation(f"{api} was requested but only `onecall` "
f"is supported", "1.0.0")
api = "onecall"
assert units in ("metric", "imperial", "standard")
Expand Down
2 changes: 1 addition & 1 deletion neon_api_proxy/services/wolfram_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _build_query_string(**kwargs) -> str:
query_params = dict()
query_params['i'] = kwargs.get("query")
query_params['units'] = kwargs.get("units") if \
kwargs.get("units", kwargs.get("unit")) == "metric" else "imperial"
kwargs.get("units") == "metric" else "imperial"
lat = kwargs.get("lat")
lng = kwargs.get("lng")
if kwargs.get("latlong"):
Expand Down

0 comments on commit 7a76127

Please sign in to comment.