Skip to content

Commit 48c5311

Browse files
committed
refactor to match PortalBase refactor for use of secrets_data
1 parent dbde186 commit 48c5311

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

adafruit_pyportal/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ def __init__(
128128
success_callback=None,
129129
esp=None,
130130
external_spi=None,
131-
debug=False
131+
debug=False,
132+
secrets_data=None,
132133
):
133134

134135
graphics = Graphics(
@@ -166,6 +167,7 @@ def __init__(
166167
image_position=image_position,
167168
image_dim_json_path=image_dim_json_path,
168169
debug=debug,
170+
secrets_data = secrets_data
169171
)
170172

171173
self.url = url

adafruit_pyportal/network.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# pylint: disable=unused-import
2929
from adafruit_portalbase.network import (
3030
NetworkBase,
31-
secrets,
3231
CONTENT_JSON,
3332
CONTENT_TEXT,
3433
)
@@ -74,13 +73,15 @@ def __init__(
7473
image_resize=None,
7574
image_position=None,
7675
image_dim_json_path=None,
76+
secrets_data = None,
7777
):
7878
wifi = WiFi(status_neopixel=status_neopixel, esp=esp, external_spi=external_spi)
7979

8080
super().__init__(
8181
wifi,
8282
extract_values=extract_values,
8383
debug=debug,
84+
secrets_data=secrets_data,
8485
)
8586

8687
self._convert_image = convert_image
@@ -103,8 +104,8 @@ def image_converter_url(image_url, width, height, color_depth=16):
103104
with the given width and height. aio_username and aio_key must be
104105
set in secrets."""
105106
try:
106-
aio_username = secrets["aio_username"]
107-
aio_key = secrets["aio_key"]
107+
aio_username = self._secrets["aio_username"]
108+
aio_key = self._secrets["aio_key"]
108109
except KeyError as error:
109110
raise KeyError(
110111
"\n\nOur image converter service require a login/password to rate-limit. Please register for a free adafruit.io account and place the user/key in your secrets file under 'aio_username' and 'aio_key'" # pylint: disable=line-too-long

0 commit comments

Comments
 (0)