vangorra / python_withings_api

Library for the Withings Health API
MIT License
101 stars 34 forks source link

Code stopped working, Error 503 for sleep data #62

Closed cohen-rachel closed 3 years ago

cohen-rachel commented 3 years ago

I have been using this code for a couple months and it was working perfectly the last time I checked it at the end of January 2021. Now when I run it I get an error trying to call sleep_get

This is the line that causes the error: sleep = api.sleep_get(startdate=arrow.get('2021-01-20T21:23:58.970460+05:00'), enddate=arrow.utcnow(), data_fields=list(GetSleepField)) However using the line to use sleep_get_summary is working perfectly, with the same inputs (startdate and enddate).

Now when I try to get the sleep data, I get the following error:

InvalidParamsException Traceback (most recent call last)

in ----> 1 sleep = api.sleep_get(data_fields = [f for f in GetSleepField], startdate=arrow.get('2021-01-20T21:23:58.970460+07:00'), enddate=arrow.utcnow()) c:\users\rachel\appdata\local\programs\python\python38\lib\site-packages\withings_api\__init__.py in sleep_get(self, data_fields, startdate, enddate) 178 update_params(params, "action", "get") 179 --> 180 return SleepGetResponse(**self.request(path=self.PATH_V2_SLEEP, params=params)) 181 182 def sleep_get_summary( c:\users\rachel\appdata\local\programs\python\python38\lib\site-packages\withings_api\__init__.py in request(self, path, params, method) 76 ) -> Dict[str, Any]: 77 """Request a specific service.""" ---> 78 return response_body_or_raise( 79 self._request(method=method, path=path, params=params) 80 ) c:\users\rachel\appdata\local\programs\python\python38\lib\site-packages\withings_api\common.py in response_body_or_raise(data) 823 raise AuthFailedException(status=status) 824 if status in STATUS_INVALID_PARAMS: --> 825 raise InvalidParamsException(status=status) 826 if status in STATUS_UNAUTHORIZED: 827 raise UnauthorizedException(status=status) InvalidParamsException: Error code 503

Thanks!

LunaHub commented 3 years ago

I am getting the same error. I just install the library last week.

On a different note: I am going to use the ScanWatch for a research study, but I am totally new with this - does anybody have time to answer some dummy questions from a newbi? lunash94@hotmail.com