Skip to content

Commit d37a7ff

Browse files
authored
Merge pull request #12 from justmobilize/fix-invalid-secret-lookup
Fix invalid secret lookup
2 parents ce4d242 + ed93b82 commit d37a7ff

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

adafruit_esp32s2tft/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class ESP32S2TFT(PortalBase):
6464
:param scale: Default scale is 1, but can be an integer of 1 or greater
6565
:param debug: Turn on debug print outs. Defaults to False.
6666
:param use_network: Enable network initialization. Defaults to True.
67-
Setting to False will allow you to use the library without a secrets.py
67+
Setting to False will allow you to use the library without a settings.toml
6868
file with wifi configuration in it.
6969
7070
"""

adafruit_esp32s2tft/network.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,12 @@ def __init__(
7373

7474
def init_io_mqtt(self) -> IO_MQTT:
7575
"""Initialize MQTT for Adafruit IO"""
76-
try:
77-
aio_username = self._secrets["aio_username"]
78-
aio_key = self._secrets["aio_key"]
79-
except KeyError:
80-
raise KeyError(
81-
"Adafruit IO secrets are kept in secrets.py, please add them there!\n\n"
82-
) from KeyError
76+
aio_username = self._get_setting["ADAFRUIT_AIO_USERNAME"]
77+
aio_key = self._get_setting["ADAFRUIT_AIO_KEY"]
78+
if None in [aio_username, aio_key]:
79+
raise AttributeError(
80+
"Adafruit IO keys are kept in settings.toml, please add them there."
81+
)
8382

8483
return self.init_mqtt(IO_MQTT_BROKER, 8883, aio_username, aio_key, True)
8584

docs/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"ssl",
3434
"wifi",
3535
"socketpool",
36-
"secrets",
3736
"bitmaptools",
3837
]
3938

0 commit comments

Comments
 (0)