Skip to content

Commit 8cf5e3d

Browse files
committed
Remove secrets usage
1 parent c83fd21 commit 8cf5e3d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

examples/displayio_flipclock_ntp_test.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
to show and update the current time with a FlipClock on a display.
88
"""
99

10+
from os import getenv
1011
import time
1112
import board
1213
import socketpool
@@ -16,12 +17,9 @@
1617
import adafruit_ntp
1718
from adafruit_displayio_flipclock.flip_clock import FlipClock
1819

19-
# Get wifi details and more from a secrets.py file
20-
try:
21-
from secrets import secrets
22-
except ImportError:
23-
print("WiFi secrets are kept in secrets.py, please add them there!")
24-
raise
20+
# Get WiFi details, ensure these are setup in settings.toml
21+
ssid = getenv("CIRCUITPY_WIFI_SSID")
22+
password = getenv("CIRCUITPY_WIFI_PASSWORD")
2523

2624
ANIMATION_DELAY = 0.01
2725
TRANSPARENT_INDEXES = range(11)
@@ -30,7 +28,7 @@
3028
MEDIUM_LEVEL = 0.9
3129
UTC_OFFSET = -5
3230

33-
wifi.radio.connect(secrets["ssid"], secrets["password"])
31+
wifi.radio.connect(ssid, password)
3432
pool = socketpool.SocketPool(wifi.radio)
3533
ntp = adafruit_ntp.NTP(pool, tz_offset=UTC_OFFSET)
3634

0 commit comments

Comments
 (0)