coddingtonbear / python-myfitnesspal

Access your meal tracking data stored in MyFitnessPal programatically
MIT License
794 stars 136 forks source link

KeyError 'fiber' for get_date -> _get_meals -> _get_measurement when unit aware is true #110

Closed kb1900 closed 2 years ago

kb1900 commented 3 years ago

`
KeyError: 'fiber'

data = client.get_date(start_date) File "myfitnesspal/client.py", line 452, in get_date meals = self._get_meals(document) File "myfitnesspal/client.py", line 319, in _get_meals nutrition[nutr_name] = self._get_measurement(nutr_name, value) File "myfitnesspal/client.py", line 218, in _get_measurement measure, kwarg = self.DEFAULT_MEASURE_AND_UNIT[name]`

I'd like using measurement objects for my data but am not able to load certain logs with unit_aware set to True due to the keyerror.

i think this would be an easy fix to just add the key value pair "fiber": Mass(g=0), to DEFAULT_MEASURE_AND_UNIT