Added docstring for new param
This commit is contained in:
parent
8780e56a35
commit
0396e0a357
1 changed files with 7 additions and 1 deletions
|
|
@ -319,6 +319,10 @@ class NetworkBase:
|
|||
def connect(self, max_attempts=10):
|
||||
"""
|
||||
Connect to WiFi using the settings found in secrets.py
|
||||
|
||||
:param max_attempts: The maximum number of of attempts to connect to WiFi before
|
||||
failing or use None to disable. Defaults to 10.
|
||||
|
||||
"""
|
||||
self._wifi.neo_status(STATUS_CONNECTING)
|
||||
attempt = 1
|
||||
|
|
@ -342,7 +346,9 @@ class NetworkBase:
|
|||
self.requests = self._wifi.requests
|
||||
except RuntimeError as error:
|
||||
if max_attempts is not None and attempt >= max_attempts:
|
||||
raise OSError("Maximum attempts reached when trying to connect to WiFi")
|
||||
raise OSError(
|
||||
"Maximum number of attempts reached when trying to connect to WiFi"
|
||||
)
|
||||
print("Could not connect to internet", error)
|
||||
print("Retrying in 3 seconds...")
|
||||
attempt += 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue