Skip to content

Commit 0396e0a

Browse files
committed
Added docstring for new param
1 parent 8780e56 commit 0396e0a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

adafruit_portalbase/network.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ def wget(self, url, filename, *, chunk_size=12000):
319319
def connect(self, max_attempts=10):
320320
"""
321321
Connect to WiFi using the settings found in secrets.py
322+
323+
:param max_attempts: The maximum number of of attempts to connect to WiFi before
324+
failing or use None to disable. Defaults to 10.
325+
322326
"""
323327
self._wifi.neo_status(STATUS_CONNECTING)
324328
attempt = 1
@@ -342,7 +346,9 @@ def connect(self, max_attempts=10):
342346
self.requests = self._wifi.requests
343347
except RuntimeError as error:
344348
if max_attempts is not None and attempt >= max_attempts:
345-
raise OSError("Maximum attempts reached when trying to connect to WiFi")
349+
raise OSError(
350+
"Maximum number of attempts reached when trying to connect to WiFi"
351+
)
346352
print("Could not connect to internet", error)
347353
print("Retrying in 3 seconds...")
348354
attempt += 1

0 commit comments

Comments
 (0)