Skip to content

Commit

Permalink
fix(weather): hide widget when API key or location is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
amnweb committed Feb 10, 2025
1 parent 0777216 commit be368da
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core/widgets/yasb/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def __init__(
self._api_key = api_key if api_key != 'env' else os.getenv('YASB_WEATHER_API_KEY')
if not self._api_key or not self._location:
logging.error("API key or location is missing. Please provide a valid API key and location.")
self.hide()
return
self.api_url = f"http://api.weatherapi.com/v1/forecast.json?key={self._api_key}&q={urllib.parse.quote(self._location)}&days=3&aqi=no&alerts=yes"
self._units = units
Expand Down

0 comments on commit be368da

Please # to comment.