Skip to content

Commit 1614277

Browse files
toggle password
1 parent 410e5a8 commit 1614277

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

adafruit_esp32spi/adafruit_esp32spi.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def _send_command_get_response(
325325
*,
326326
reply_params=1,
327327
sent_param_len_16=False,
328-
recv_param_len_16=False
328+
recv_param_len_16=False,
329329
):
330330
"""Send a high level SPI command, wait and return the response"""
331331
self._send_command(cmd, params, param_len_16=sent_param_len_16)
@@ -563,17 +563,23 @@ def connect(self, secrets):
563563
that contains a 'ssid' and 'password' entry"""
564564
self.connect_AP(secrets["ssid"], secrets["password"])
565565

566-
def connect_AP(self, ssid, password, timeout_s=10): # pylint: disable=invalid-name
566+
def connect_AP(
567+
self, ssid, password, timeout_s=10, show_password=False
568+
): # pylint: disable=invalid-name
567569
"""Connect to an access point with given name and password.
568570
Will wait until specified timeout seconds and return on success
569571
or raise an exception on failure.
570572
571573
:param ssid: the SSID to connect to
572574
:param passphrase: the password of the access point
573575
:param timeout_s: number of seconds until we time out and fail to create AP
576+
:param show_password: print password if debug == True (default False)
574577
"""
575578
if self._debug:
576-
print("Connect to AP", ssid, password)
579+
print(
580+
f"Connect to AP: {ssid=}, password=\
581+
{repr(password if show_password else '*' * len(password))}"
582+
)
577583
if isinstance(ssid, str):
578584
ssid = bytes(ssid, "utf-8")
579585
if password:

0 commit comments

Comments
 (0)