matin / garth

Garmin SSO auth + Connect Python client
MIT License
274 stars 20 forks source link

garth.SleepData: DailySleepDTO missing 'sleep_from_device' and 'sleep_version' #22

Closed andgineer closed 11 months ago

andgineer commented 11 months ago

When I do in provided colab notebook garth.SleepData.get("2023-10-03")

I get error:

ValidationError Traceback (most recent call last) in <cell line: 1>() ----> 1 garth.SleepData.get("2023-10-03")

2 frames /usr/local/lib/python3.10/dist-packages/pydantic/dataclasses.cpython-310-x86_64-linux-gnu.so in pydantic.dataclasses._dataclass_validate_values()

ValidationError: 1 validation error for SleepData daily_sleep_dto DailySleepDTO.init() missing 2 required positional arguments: 'sleep_from_device' and 'sleep_version' (type=type_error)

matin commented 11 months ago

What happens when you call the endpoint directly?

garth.connectapi(f"/wellness-service/wellness/dailySleepData/{garth.client.username}?nonSleepBufferMinutes=60&date=2023-10-03")
andgineer commented 11 months ago

it works if I use the direcdt endpoint.

and garth.SleepData.get("2023-10-03") return the same error

matin commented 11 months ago

Working on a fix #23

matin commented 11 months ago

@andgineer can you try version 0.4.37?

andgineer commented 11 months ago

hm in the colab Successfully installed garth-0.4.37

but the error the same (I repeated all steps in the notebook)

may be I should refresh something?

matin commented 11 months ago

If you're in Colab, you have to disconnect and delete runtime. When you restart, it'll install the latest version.

You can check garth.__version__ to verify.

andgineer commented 11 months ago

%pip install garth --upgrade Requirement already satisfied: garth in /usr/local/lib/python3.10/dist-packages (0.4.37)

import garth garth.version 0.4.36

matin commented 11 months ago

Did you disconnect and delete the runtime?

Colab can't upgrade a package in the same environment. It won't load the new version.

andgineer commented 11 months ago

sorry for all the confusion in .37 it works

thank you for blazingly fast fix

matin commented 11 months ago

@andgineer out of curiosity, did you find the graphs generated by the Colabs useful / interesting?

andgineer commented 11 months ago

honestly, I could not see any dependencies even I know they exist just because I changed my habits significantly

but you know that could be the question of Garmin data that they just do not reflect the changes