Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for bug prevening retry code in Star Fragment Lamp ( issue #2444) #2445

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions Star_Fragment_Lamp/code.py
Expand Up @@ -62,7 +62,7 @@ def reset_on_error(delay, error):
def get_request(tries, ping):
for i in range(tries):
try:
n = ping
n = ping()
except Exception as error:
print(error)
time.sleep(10)
Expand All @@ -75,7 +75,7 @@ def get_request(tries, ping):
# get the time on start-up
# pylint: disable=broad-except
try:
now = get_request(5, io.receive_time())
now = get_request(5, io.receive_time)
except Exception as e:
reset_on_error(10, e)
print(now)
Expand All @@ -84,7 +84,7 @@ def get_request(tries, ping):
# function to make a request to open-meteo
def sun_clock():
# make the API request
response = get_request(5, requests.get(weather_url))
response = get_request(5, lambda : requests.get(weather_url))
# packs the response into a JSON
response_as_json = response.json()
# gets sunrise
Expand Down Expand Up @@ -120,7 +120,7 @@ def divide_time(z):

# function that tracks how many hours/minutes until sunrise or sunset
def sun_countdown(sun_event):
n = get_request(5, io.receive_time())
n = get_request(5, io.receive_time)
remaining = time.mktime(sun_event) - time.mktime(n)
r = remaining
# print(remaining)
Expand Down Expand Up @@ -259,7 +259,7 @@ def sun_countdown(sun_event):
# otherwise just keep checking every 15 minutes
# and keep neopixels on
else:
now = get_request(5, io.receive_time())
now = get_request(5, io.receive_time)
print("not looking for sunrise")
print(now)
print()
Expand Down