Closed Gishan86 closed 1 year ago
Thanks for your quick response!
I've also tried 2022-10-15 to 2022-10-20 and 2023-10-01 to 2023-10-05 which both resulted in the same exception
Yeah, that was a typo, not a time traveller. :) With 2022-10-18 I get results but they are all empty. It returns an empty entry for every 15 minutes of the day like this:
[{'startGMT': '2022-10-17T22:00:00.0', 'endGMT': '2022-10-17T22:15:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-17T22:15:00.0', 'endGMT': '2022-10-17T22:30:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-17T22:30:00.0', 'endGMT': '2022-10-17T22:45:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-17T22:45:00.0', 'endGMT': '2022-10-17T23:00:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-17T23:00:00.0', 'endGMT': '2022-10-17T23:15:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-17T23:15:00.0', 'endGMT': '2022-10-17T23:30:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-17T23:30:00.0', 'endGMT': '2022-10-17T23:45:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-17T23:45:00.0', 'endGMT': '2022-10-18T00:00:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-18T00:00:00.0', 'endGMT': '2022-10-18T00:15:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-18T00:15:00.0', 'endGMT': '2022-10-18T00:30:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-18T00:30:00.0', 'endGMT': '2022-10-18T00:45:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-18T00:45:00.0', 'endGMT': '2022-10-18T01:00:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-18T01:00:00.0', 'endGMT': '2022-10-18T01:15:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, {'startGMT': '2022-10-18T01:15:00.0', 'endGMT': '2022-10-18T01:30:00.0', 'steps': 0, 'pushes': 0, 'primaryActivityLevel': 'none', 'activityLevelConstant': True}, ...]
The web UI shows 17.843 steps for 2022-10-18 though.
I have the same issue for 2022-10-18. Can you try a more recent date like 2023-10-01?
weekly works though:
api.garth.connectapi('/usersummary-service/stats/steps/weekly/2022-10-18/52')
daily also works for me:
api.get_daily_steps('2022-10-01', '2022-10-28')
It looks like the issue is when you want to get the granular data for an individual day.
Figured it out ...
Take a look at this:
You can do the following:
resp = api.garth.post('connectapi', '/wellness-service/wellness/epoch/request/2022-10-18', api=True)
resp.json()
Response:
{'userProfilePk': 2591602,
'calendarDate': '2022-10-18',
'status': 'SUBMITTED',
'source': 'USER',
'ghReloadMetaData': '',
'createDate': '2023-10-16T17:49:56.980',
'deviceList': [{'deviceId': 3329978681,
'deviceName': 'fēnix® 6X - Pro and Sapphire Editions',
'preferredActivityTracker': True}]}
Wait a few minutes for the data to load
Make the request again
api.get_steps_data("2022-10-18")
In other words, this is not a garminconnect or Garth issue. It has to do with how Garmin handles old data.
This issue can be closed as it has instructions to:
HTH!
@cyberjunky not sure if you want to add the following endpoint:
api.garth.post('connectapi', '/wellness-service/wellness/epoch/request/2022-10-18', api=True)
See the conversation above for context on what it does.
Thanks, would appreciate if the endpoint could be added
Lets keep open so I won't forget to add it ;)
@cyberjunky not sure if you want to add the following endpoint:
api.garth.post('connectapi', '/wellness-service/wellness/epoch/request/2022-10-18', api=True)
See the conversation above for context on what it does @matin Can you enlighten me, didn't follow whole issue... Do I need to add this fixed endpoint with 2022-10-18 at the end?
@cyberjunky created the PR #174 with tests
Here's how it works:
def test_request_reload(garmin):
garmin.login()
cdate = "2021-01-01"
assert sum(steps['steps'] for steps in garmin.get_steps_data(cdate)) == 0
assert garmin.request_reload(cdate)
# In practice, the data can take a while to load
assert sum(steps['steps'] for steps in garmin.get_steps_data(cdate)) > 0
Hi, did Garmin change the url for steps data? Neither one of these work:
json = api.get_daily_steps("2023-01-01", "2023-10-01")
Throws garth.exc.GarthHTTPError: Error in request: 400 Client Error: Bad Request for url: https://connectapi.garmin.com/usersummary-service/stats/steps/daily/2023-01-01/2023-10-01json = api.get_steps_data("2023-10-17")
Returns an empty list.On https://connect.garmin.com there is step data for 2023-10-17. Other routes like get_weigh_ins work and return data.