Closed mattia93 closed 10 months ago
I'll take a look tomorrow.
@mattia93 My only theory is that displayName
and userName
for you are different. The garminconnect code uses displayName
where it should probably be using userName
instead.
Could you run the following Colab and let me know if displayName
and userName
for you are the same or different?
If they are different for you, that would explain the 401 and is an easy code fix.
Hi!
They are actually different, the userName
value is my email while the displayName
is the string that identifies my profile (i.e. https://connect.garmin.com/modern/profile/my-display-name on the web app).
How can I fix this problem? I tried to change displayName
to userName
but I still get the 404 error.
Thanks again for your help
How familiar are you with VCR?
I can't reproduce the issue, but if I see the VCR cassettes, it'll be easier.
Hi! Thanks again for your help. I installed the vcrpy
module and wrapped the get_sleep_data
function.
I'm attaching the YAML file. I've never used the package before so I hope I did everything correctly.
sleep.yaml.zip
I'll take a look
Here's the URL that's being called in your case:
https://connectapi.garmin.com/wellness-service/wellness/dailySleepData/94a151c4-3d2f-473f-9d1f-4f60f0c577ed?date=2023-10-22T00%3A00%3A00&nonSleepBufferMinutes=60
This is clearly not correct: 94a151c4-3d2f-473f-9d1f-4f60f0c577ed
Can you try running this Colab? https://colab.research.google.com/gist/matin/21a1767069b24f627a7c83dfaf503951/garmin-sleep-data.ipynb
That uses your username (instead of displayname) in the URL.
Thanks a lot, now it works! I actually found out that the error was in the way the formatting of the date (it was 2023-10-22T00:00:00
instead of being 2023-10-22
). I can confirm that it works either with username and with displayname.
Thanks again for the help and for the great work
Great to hear! Can we close this out?
@mattia93 If you like evaluating your sleep data, you should take a look at this Colab that provides some interesting graphs: https://colab.research.google.com/github/matin/garth/blob/main/colabs/sleep.ipynb
@cyberjunky this has been resolved and can be closed.
Hi! I managed to log in (only without tokens though) and get my stats. However, when I call the
get_sleep_data
function I get this error:This is my configuration:
I can't understand if the problem is related to Garth, as I also get
401: Unauthorized
when logging in with the tokens, or it it's related to the http address. Thank you for your help and for your amazing work