Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions adafruit_portalbase/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,22 @@ def connect(self, max_attempts=10):
"'networks' must be a list/tuple of dicts of 'ssid' and 'password'"
)

self._wifi_credentials = list(
filter(
lambda credentials: isinstance(credentials, (list, tuple))
and "ssid" in credentials
and "password" in credentials
and type(credentials["ssid"]) is str
and type(credentials["password"]) is str
and len(credentials["ssid"])
and len(credentials["password"]),
self._wifi_credentials,
)
)
if not len(self._wifi_credentials):
self._wifi_credentials = None
raise OSError("No wifi credentials provided")

for credentials in self._wifi_credentials:
self._wifi.neo_status(STATUS_CONNECTING)
attempt = 1
Expand Down