Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_bodyweight uses /log/ API, which has max period of 31d. #141

Open
jlapenna opened this issue Nov 19, 2018 · 0 comments
Open

get_bodyweight uses /log/ API, which has max period of 31d. #141

jlapenna opened this issue Nov 19, 2018 · 0 comments

Comments

@jlapenna
Copy link

jlapenna commented Nov 19, 2018

If you pass period='max' to Fitbit.get_bodyweight it fails:

File "/home/jlapenna/code/bikebuds/gae/api/shared/services/withings/bbfitbit.py", line 30, in sync
  measures = client.get_bodyweight(period='1y')
File "/home/jlapenna/code/bikebuds/gae/api/lib/fitbit/api.py", line 845, in get_bodyweight
  return self._get_body('weight', base_date, user_id, period, end_date)
File "/home/jlapenna/code/bikebuds/gae/api/lib/fitbit/api.py", line 882, in _get_body
  return self.make_request(url)
File "/home/jlapenna/code/bikebuds/gae/api/lib/fitbit/api.py", line 223, in make_request
  response = self.client.make_request(*args, **kwargs)
File "/home/jlapenna/code/bikebuds/gae/api/lib/fitbit/api.py", line 99, in make_request
  exceptions.detect_and_raise_error(response)
File "/home/jlapenna/code/bikebuds/gae/api/lib/fitbit/exceptions.py", line 96, in detect_and_raise_error
  raise HTTPBadRequest(response)
HTTPBadRequest: Invalid period: max

This is due to using the https://dev.fitbit.com/build/reference/web-api/body/#get-weight-logs API.

If it used https://dev.fitbit.com/build/reference/web-api/body/#get-body-time-series then you could fetch longer, but the data returned is different, too (this is a supported, different API call, time_series()).

This bug will be to change the accepted period parameters for get_bodyweight and get_bodyfat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant