-
Notifications
You must be signed in to change notification settings - Fork 55
Refactor to use secrets_data like PortalBase #101
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
Changes from 5 commits
6291e58
dbde186
48c5311
dd82024
8c0cb16
3b37703
282f1ae
241b2f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,6 @@ | |
# pylint: disable=unused-import | ||
from adafruit_portalbase.network import ( | ||
NetworkBase, | ||
secrets, | ||
CONTENT_JSON, | ||
CONTENT_TEXT, | ||
) | ||
|
@@ -74,13 +73,15 @@ def __init__( | |
image_resize=None, | ||
image_position=None, | ||
image_dim_json_path=None, | ||
secrets_data=None, | ||
): | ||
wifi = WiFi(status_neopixel=status_neopixel, esp=esp, external_spi=external_spi) | ||
|
||
super().__init__( | ||
wifi, | ||
extract_values=extract_values, | ||
debug=debug, | ||
secrets_data=secrets_data, | ||
) | ||
|
||
self._convert_image = convert_image | ||
|
@@ -89,22 +90,21 @@ def __init__( | |
self._image_resize = image_resize | ||
self._image_position = image_position | ||
self._image_dim_json_path = image_dim_json_path | ||
|
||
self._secrets = secrets_data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be necessary because it is already being set in the base class. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! I ran into a CI issue, but I think that was because your PortalBase PR hadn't been merged yet. |
||
gc.collect() | ||
|
||
@property | ||
def ip_address(self): | ||
"""Return the IP Address nicely formatted""" | ||
return self._wifi.esp.pretty_ip(self._wifi.esp.ip_address) | ||
|
||
@staticmethod | ||
def image_converter_url(image_url, width, height, color_depth=16): | ||
def image_converter_url(self, image_url, width, height, color_depth=16): | ||
"""Generate a converted image url from the url passed in, | ||
with the given width and height. aio_username and aio_key must be | ||
set in secrets.""" | ||
try: | ||
aio_username = secrets["aio_username"] | ||
aio_key = secrets["aio_key"] | ||
aio_username = self._secrets["aio_username"] | ||
aio_key = self._secrets["aio_key"] | ||
except KeyError as error: | ||
raise KeyError( | ||
"\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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this accidentally added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there were erroneous lines added to this when I created my fork.