@@ -203,11 +203,13 @@ def url_encode(url):
203
203
"""
204
204
return url .replace (" " , "+" ).replace ("%" , "%25" ).replace (":" , "%3A" )
205
205
206
- def get_strftime (self , time_format , location = None ):
206
+ def get_strftime (self , time_format , location = None , max_attempts = 10 ):
207
207
"""
208
208
Fetch a custom strftime relative to your location.
209
209
210
210
: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.
211
213
212
214
"""
213
215
# pylint: disable=line-too-long
@@ -259,12 +261,14 @@ def get_strftime(self, time_format, location=None):
259
261
260
262
return reply
261
263
262
- def get_local_time (self , location = None ):
264
+ def get_local_time (self , location = None , max_attempts = 10 ):
263
265
# pylint: disable=line-too-long
264
266
"""
265
267
Fetch and "set" the local time of this microcontroller to the local time at the location, using an internet time API.
266
268
267
269
: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.
268
272
269
273
"""
270
274
reply = self .get_strftime (TIME_SERVICE_FORMAT , location = location )
0 commit comments