@@ -273,7 +273,9 @@ def connectapi(self, path: str, **kwargs: Any) -> Any:
273
273
return self .garth .connectapi (path , ** kwargs )
274
274
except HTTPError as e :
275
275
status = getattr (getattr (e , "response" , None ), "status_code" , None )
276
- logger .error ("API call failed for path '%s': %s (status=%s)" , path , e , status )
276
+ logger .error (
277
+ "API call failed for path '%s': %s (status=%s)" , path , e , status
278
+ )
277
279
if status == 401 :
278
280
raise GarminConnectAuthenticationError (
279
281
f"Authentication failed: { e } "
@@ -293,7 +295,9 @@ def download(self, path: str, **kwargs: Any) -> Any:
293
295
return self .garth .download (path , ** kwargs )
294
296
except Exception as e :
295
297
status = getattr (getattr (e , "response" , None ), "status_code" , None )
296
- logger .error ("Download failed for path '%s': %s (status=%s)" , path , e , status )
298
+ logger .error (
299
+ "Download failed for path '%s': %s (status=%s)" , path , e , status
300
+ )
297
301
if status == 401 :
298
302
raise GarminConnectAuthenticationError (f"Download error: { e } " ) from e
299
303
if status == 429 :
@@ -613,7 +617,7 @@ def add_weigh_in(
613
617
614
618
def add_weigh_in_with_timestamps (
615
619
self ,
616
- weight : int ,
620
+ weight : int | float ,
617
621
unitKey : str = "kg" ,
618
622
dateTimestamp : str = "" ,
619
623
gmtTimestamp : str = "" ,
@@ -1251,9 +1255,16 @@ def get_race_predictions(
1251
1255
elif _type is not None and startdate is not None and enddate is not None :
1252
1256
startdate = _validate_date_format (startdate , "startdate" )
1253
1257
enddate = _validate_date_format (enddate , "enddate" )
1254
- if (datetime .strptime (enddate , DATE_FORMAT_STR ).date () - datetime .strptime (startdate , DATE_FORMAT_STR ).date ()).days > 366 :
1255
- raise ValueError ("Startdate cannot be more than one year before enddate" )
1256
- url = self .garmin_connect_race_predictor_url + f"/{ _type } /{ self .display_name } "
1258
+ if (
1259
+ datetime .strptime (enddate , DATE_FORMAT_STR ).date ()
1260
+ - datetime .strptime (startdate , DATE_FORMAT_STR ).date ()
1261
+ ).days > 366 :
1262
+ raise ValueError (
1263
+ "Startdate cannot be more than one year before enddate"
1264
+ )
1265
+ url = (
1266
+ self .garmin_connect_race_predictor_url + f"/{ _type } /{ self .display_name } "
1267
+ )
1257
1268
params = {"fromCalendarDate" : startdate , "toCalendarDate" : enddate }
1258
1269
return self .connectapi (url , params = params )
1259
1270
0 commit comments