Improve logging

This commit is contained in:
Jules 2023-12-27 11:18:21 +01:00
parent 1ad42f5d7f
commit 2644ba3bd5
Signed by: jdejaegh
GPG key ID: 99D6D184CA66933A

View file

@ -37,18 +37,12 @@ def _api_key(method_name: str):
class IrmKmiApiClient: class IrmKmiApiClient:
"""Sample API Client.""" """Sample API Client."""
COORD_DECIMALS = 6 COORD_DECIMALS = 6
def __init__(self, session: aiohttp.ClientSession) -> None: def __init__(self, session: aiohttp.ClientSession) -> None:
"""Sample API Client.""" """Sample API Client."""
self._session = session self._session = session
self._base_url = "https://app.meteo.be/services/appv4/" self._base_url = "https://app.meteo.be/services/appv4/"
async def get_forecasts_city(self, city_id: int) -> any:
"""Get forecasts for given city."""
return await self._api_wrapper(
params={"ins": city_id,
"s": "getForecasts"}
)
async def get_forecasts_coord(self, coord: dict) -> any: async def get_forecasts_coord(self, coord: dict) -> any:
"""Get forecasts for given city.""" """Get forecasts for given city."""
assert 'lat' in coord assert 'lat' in coord
@ -99,5 +93,5 @@ class IrmKmiApiClient:
) from exception ) from exception
except Exception as exception: # pylint: disable=broad-except except Exception as exception: # pylint: disable=broad-except
raise IrmKmiApiError( raise IrmKmiApiError(
"Something really wrong happened!" f"Something really wrong happened! {exception}"
) from exception ) from exception