Skip to content

Commit 926e4d7

Browse files
authored
fix for issue adafruit#2444
1 parent a2a2916 commit 926e4d7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: Star_Fragment_Lamp/code.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def reset_on_error(delay, error):
6262
def get_request(tries, ping):
6363
for i in range(tries):
6464
try:
65-
n = ping
65+
n = ping()
6666
except Exception as error:
6767
print(error)
6868
time.sleep(10)
@@ -75,7 +75,7 @@ def get_request(tries, ping):
7575
# get the time on start-up
7676
# pylint: disable=broad-except
7777
try:
78-
now = get_request(5, io.receive_time())
78+
now = get_request(5, io.receive_time)
7979
except Exception as e:
8080
reset_on_error(10, e)
8181
print(now)
@@ -84,7 +84,7 @@ def get_request(tries, ping):
8484
# function to make a request to open-meteo
8585
def sun_clock():
8686
# make the API request
87-
response = get_request(5, requests.get(weather_url))
87+
response = get_request(5, lambda : requests.get(weather_url))
8888
# packs the response into a JSON
8989
response_as_json = response.json()
9090
# gets sunrise
@@ -120,7 +120,7 @@ def divide_time(z):
120120

121121
# function that tracks how many hours/minutes until sunrise or sunset
122122
def sun_countdown(sun_event):
123-
n = get_request(5, io.receive_time())
123+
n = get_request(5, io.receive_time)
124124
remaining = time.mktime(sun_event) - time.mktime(n)
125125
r = remaining
126126
# print(remaining)
@@ -259,7 +259,7 @@ def sun_countdown(sun_event):
259259
# otherwise just keep checking every 15 minutes
260260
# and keep neopixels on
261261
else:
262-
now = get_request(5, io.receive_time())
262+
now = get_request(5, io.receive_time)
263263
print("not looking for sunrise")
264264
print(now)
265265
print()

0 commit comments

Comments
 (0)