polybar-weather: try harder to wait to be online

This commit is contained in:
Vincent Bernat 2021-08-13 23:01:13 +02:00
parent 481b258fe0
commit 6b0c7b4c1d

View file

@ -133,8 +133,10 @@ if __name__ == "__main__":
try:
# Get location
while True:
try:
location, city = get_location()
break
except requests.exceptions.ConnectionError:
# Wait to be online
logger.info("not online, waiting")
@ -146,7 +148,6 @@ if __name__ == "__main__":
if process.returncode != 0:
logger.warning("not online, exiting")
sys.exit(1)
location, city = get_location()
# Grab current weather and daily forecast
weather = get_weather(options.owm_api_key, *location)