@@ -273,7 +273,9 @@ def connectapi(self, path: str, **kwargs: Any) -> Any:
273273 return self .garth .connectapi (path , ** kwargs )
274274 except HTTPError as e :
275275 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+ )
277279 if status == 401 :
278280 raise GarminConnectAuthenticationError (
279281 f"Authentication failed: { e } "
@@ -293,7 +295,9 @@ def download(self, path: str, **kwargs: Any) -> Any:
293295 return self .garth .download (path , ** kwargs )
294296 except Exception as e :
295297 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+ )
297301 if status == 401 :
298302 raise GarminConnectAuthenticationError (f"Download error: { e } " ) from e
299303 if status == 429 :
@@ -613,7 +617,7 @@ def add_weigh_in(
613617
614618 def add_weigh_in_with_timestamps (
615619 self ,
616- weight : int ,
620+ weight : int | float ,
617621 unitKey : str = "kg" ,
618622 dateTimestamp : str = "" ,
619623 gmtTimestamp : str = "" ,
@@ -1251,9 +1255,16 @@ def get_race_predictions(
12511255 elif _type is not None and startdate is not None and enddate is not None :
12521256 startdate = _validate_date_format (startdate , "startdate" )
12531257 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+ )
12571268 params = {"fromCalendarDate" : startdate , "toCalendarDate" : enddate }
12581269 return self .connectapi (url , params = params )
12591270
0 commit comments