@@ -62,7 +62,7 @@ def reset_on_error(delay, error):
62
62
def get_request (tries , ping ):
63
63
for i in range (tries ):
64
64
try :
65
- n = ping
65
+ n = ping ()
66
66
except Exception as error :
67
67
print (error )
68
68
time .sleep (10 )
@@ -75,7 +75,7 @@ def get_request(tries, ping):
75
75
# get the time on start-up
76
76
# pylint: disable=broad-except
77
77
try :
78
- now = get_request (5 , io .receive_time () )
78
+ now = get_request (5 , io .receive_time )
79
79
except Exception as e :
80
80
reset_on_error (10 , e )
81
81
print (now )
@@ -84,7 +84,7 @@ def get_request(tries, ping):
84
84
# function to make a request to open-meteo
85
85
def sun_clock ():
86
86
# make the API request
87
- response = get_request (5 , requests .get (weather_url ))
87
+ response = get_request (5 , lambda : requests .get (weather_url ))
88
88
# packs the response into a JSON
89
89
response_as_json = response .json ()
90
90
# gets sunrise
@@ -120,7 +120,7 @@ def divide_time(z):
120
120
121
121
# function that tracks how many hours/minutes until sunrise or sunset
122
122
def sun_countdown (sun_event ):
123
- n = get_request (5 , io .receive_time () )
123
+ n = get_request (5 , io .receive_time )
124
124
remaining = time .mktime (sun_event ) - time .mktime (n )
125
125
r = remaining
126
126
# print(remaining)
@@ -259,7 +259,7 @@ def sun_countdown(sun_event):
259
259
# otherwise just keep checking every 15 minutes
260
260
# and keep neopixels on
261
261
else :
262
- now = get_request (5 , io .receive_time () )
262
+ now = get_request (5 , io .receive_time )
263
263
print ("not looking for sunrise" )
264
264
print (now )
265
265
print ()
0 commit comments