Skip to content

Commit 932e56c

Browse files
committed
Add default ma_attempts param to get_local_time
1 parent 1b0c94a commit 932e56c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

adafruit_portalbase/network.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,13 @@ def url_encode(url):
203203
"""
204204
return url.replace(" ", "+").replace("%", "%25").replace(":", "%3A")
205205

206-
def get_strftime(self, time_format, location=None):
206+
def get_strftime(self, time_format, location=None, max_attempts=10):
207207
"""
208208
Fetch a custom strftime relative to your location.
209209
210210
:param str location: Your city and country, e.g. ``"America/New_York"``.
211+
:param max_attempts: The maximum number of of attempts to connect to WiFi before
212+
failing or use None to disable. Defaults to 10.
211213
212214
"""
213215
# pylint: disable=line-too-long
@@ -259,12 +261,14 @@ def get_strftime(self, time_format, location=None):
259261

260262
return reply
261263

262-
def get_local_time(self, location=None):
264+
def get_local_time(self, location=None, max_attempts=10):
263265
# pylint: disable=line-too-long
264266
"""
265267
Fetch and "set" the local time of this microcontroller to the local time at the location, using an internet time API.
266268
267269
:param str location: Your city and country, e.g. ``"America/New_York"``.
270+
:param max_attempts: The maximum number of of attempts to connect to WiFi before
271+
failing or use None to disable. Defaults to 10.
268272
269273
"""
270274
reply = self.get_strftime(TIME_SERVICE_FORMAT, location=location)

0 commit comments

Comments
 (0)