diff --git a/bin/polybar-weather b/bin/polybar-weather index 7ce4c66..ad220e7 100755 --- a/bin/polybar-weather +++ b/bin/polybar-weather @@ -20,6 +20,7 @@ def get_location(): r = requests.get( "https://www.maxmind.com/geoip/v2.1/city/me", headers={"referer": "https://www.maxmind.com/en/locate-my-ip-address"}, + timeout=10, ) r.raise_for_status() data = r.json() @@ -45,6 +46,7 @@ def get_weather(apikey, latitude, longitude): "units": "metric", "exclude": "minutely,hourly", }, + timeout=10, ) r.raise_for_status() data = r.json() @@ -145,7 +147,7 @@ if __name__ == "__main__": try: location, city = get_location() break - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, requests.exceptions.Timeout): # Wait to be online logger.info("not online, waiting") update_status("", options.output)