File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -474,4 +474,24 @@ except (
474474except Exception : # pylint: disable=broad-except
475475 print (" Unknown error occurred during Garmin Connect Client get personal record" )
476476 quit ()
477+
478+
479+ """
480+ Get hydration data
481+ """
482+ print (" client.get_hydration_data(%s )" , today.isoformat())
483+ print (" ----------------------------------------------------------------------------------------" )
484+ try :
485+ print (client.get_hydration_data(today.isoformat()))
486+ except (
487+ GarminConnectConnectionError,
488+ GarminConnectAuthenticationError,
489+ GarminConnectTooManyRequestsError,
490+ ) as err:
491+ print (" Error occurred during Garmin Connect Client get hydration data: %s " % err)
492+ quit ()
493+ except Exception : # pylint: disable=broad-except
494+ print (" Unknown error occurred during Garmin Connect Client get hydration data" )
495+ quit ()
496+
477497```
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ class Garmin(object):
2828 '/proxy/weight-service/weight/daterangesnapshot'
2929 url_activities = MODERN_URL + \
3030 '/proxy/activitylist-service/activities/search/activities'
31+ url_hydrationdata = MODERN_URL + '/proxy/usersummary-service/usersummary/hydration/daily/'
3132 url_activity = MODERN_URL + '/proxy/activity-service/activity/'
3233 url_personal_record = MODERN_URL + '/proxy/personalrecord-service/personalrecord/'
3334 url_tcx_download = MODERN_URL + "/proxy/download-service/export/tcx/activity/"
@@ -404,6 +405,15 @@ def get_device_last_used(self):
404405 "Fetching device last used with url %s" , device_last_used_url )
405406 return self .fetch_data (device_last_used_url )
406407
408+ def get_hydration_data (self , cdate ): # cDate = 'YYYY-mm-dd'
409+ """
410+ Fetch available hydration data
411+ """
412+ hydration_url = self .url_hydrationdata + cdate
413+ self .logger .debug ("Fetching hydration data with url %s" , hydration_url )
414+
415+ return self .fetch_data (hydration_url )
416+
407417 class ActivityDownloadFormat (Enum ):
408418 ORIGINAL = auto ()
409419 TCX = auto ()
Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22"""Python 3 API wrapper for Garmin Connect to get your statistics."""
33
4- __version__ = "0.1.17 "
4+ __version__ = "0.1.18 "
You can’t perform that action at this time.
0 commit comments