coddingtonbear / python-myfitnesspal

Access your meal tracking data stored in MyFitnessPal programatically
MIT License
789 stars 138 forks source link

client.get_measurements(measurement='Weight') Error (ValueError: Measurement 'Weight' does not exist.) #162

Open johnhillescobar opened 1 year ago

johnhillescobar commented 1 year ago

Hi team,

I am still getting an error from the get_measurements function. I cannot get my weight from there.

This is the error I am getting:

-----------------------------------------------------------------
ValueError                      Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_28780\1855173169.py in <module>
----> 1 client.get_measurements(measurement='Weight')

~\anaconda3\lib\site-packages\myfitnesspal\client.py in get_measurements(self, measurement, lower_bound, upper_bound)
    535             measurement_id = measurement_ids[measurement]
    536         else:
--> 537             raise ValueError(f"Measurement '{measurement}' does not exist.")
    538 
    539         page = 1

ValueError: Measurement 'Weight' does not exist.

I am properly getting data when using other functions. For example:

nutrition_activity = client.get_date(2023, 5, 25)

nutrition_activity.exercises[1].get_as_list()

>>> [{'name': 'Lateral Pull',
          'nutrition_information': {'sets': 5.0,
           'reps/set': 10.0,
           'weight/set': 120.0}}]

All the support is highly appreciated!

hannahburkhardt commented 1 year ago

could you use my branch where I fixed the issue and let me know if you’re still getting the issue there? It hasn’t been merged yet because @coddingtonbear has not had a chance to review.

johnhillescobar commented 1 year ago

Let me test it!

hlipnick commented 9 months ago

Is there anything I can help with that would get this change merged into the main branch? Would be great to have this working again.

Nevermind - realize that Hannah's change was merged, there just hasn't been a release since then so the version pulled from pip doesn't have that change. For anyone in the future (including myself), this will do the trick:

pip install git+https://github.com/coddingtonbear/python-myfitnesspal.git

Thanks!