Closed beardyFace closed 2 years ago
I will have a look, I think you are right that url with 'latest' is not the correct url.
Just ran into this one: the url for requesting a specific day should most likely be https://connect.garmin.com/modern/proxy/metrics-service/metrics/maxmet/daily/{cdate}/{cdate}
(this will return the values for the timerange beginning with the first date parameter to the second date parameter)
@ernstblecha that format works for me! Thank you!
I have amended this to latest code, thanks!
Max metrics appears to return data from the same date** regardless of the date passed into the function.
Example of output when running below as a test.
date = datetime.date(2022,1,17) logger.info(api.get_max_metrics(date.isoformat()))
date = datetime.date(2022,1,18) logger.info(api.get_max_metrics(date.isoformat()))
The URL has the correct date applied, however, the response always has the same calendar date within the data fields - is this expected behaviour or is the "latest" tag in the URL overriding the given day?
{'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0', 'NK': 'NT'} DEBUG:urllib3.connectionpool:https://connect.garmin.com:443 "GET /modern/proxy/metrics-service/metrics/maxmet/latest/2022-01-17 HTTP/1.1" 200 None {'userId': 102068004, 'generic': {'calendarDate': '2022-02-11', 'vo2MaxValue': 44.0, 'fitnessAge': 26, 'fitnessAgeDescription': 0, 'maxMetCategory': 0}, 'cycling': None, 'heatAltitudeAcclimation': {'calendarDate': None, 'altitudeAcclimationDate': None, 'previousAltitudeAcclimationDate': None, 'heatAcclimationDate': None, 'previousHeatAcclimationDate': None, 'altitudeAcclimation': None, 'previousAltitudeAcclimation': None, 'heatAcclimationPercentage': None, 'previousHeatAcclimationPercentage': None, 'heatTrend': None, 'altitudeTrend': None}}
{'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0', 'NK': 'NT'} DEBUG:urllib3.connectionpool:https://connect.garmin.com:443 "GET /modern/proxy/metrics-service/metrics/maxmet/latest/2022-01-18 HTTP/1.1" 200 None {'userId': 102068004, 'generic': {'calendarDate': '2022-02-11', 'vo2MaxValue': 44.0, 'fitnessAge': 26, 'fitnessAgeDescription': 0, 'maxMetCategory': 0}, 'cycling': None, 'heatAltitudeAcclimation': {'calendarDate': None, 'altitudeAcclimationDate': None, 'previousAltitudeAcclimationDate': None, 'heatAcclimationDate': None, 'previousHeatAcclimationDate': None, 'altitudeAcclimation': None, 'previousAltitudeAcclimation': None, 'heatAcclimationPercentage': None, 'previousHeatAcclimationPercentage': None, 'heatTrend': None, 'altitudeTrend': None}}