coddingtonbear / python-myfitnesspal

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

Login Error #117

Closed andrewteal closed 3 years ago

andrewteal commented 3 years ago

Hi all!

Firstly, kudos to all that helped make this, as it's tremendous. I was pleasantly surprised at how thorough it was out of the box.

I am having trouble logging in to MyFitnessPal when using MyFitnessPal.Client(username, password). I know this might be many things (from internet issues to something on MyFitnessPal's end), but wanted to see if anyone else is running into trouble.

I have a script using myfitnesspal that's been working reliably since July 2020 (with no changes since then), and today I cannot get a specific line to work. I'm a law student and coding is only a hobby, so apologies if this could be written out better. The line I'm running into an issue with is this:

client = myfitnesspal.Client('********', password='*******')

The error this line returns is this:

Traceback (most recent call last):
  File "/Users/Andrew/Documents/Programs/Useful_Python_Scripts/MyFitnessPal_to_Google Sheets/myFitnessPalGoogleSheets.py", line 54, in <module>
    client = myfitnesspal.Client('********', password='********')
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/myfitnesspal/client.py", line 61, in __init__
    self._login()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/myfitnesspal/client.py", line 116, in _login
    self._auth_data = self._get_auth_data()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/myfitnesspal/client.py", line 132, in _get_auth_data
    return result.json()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I've googled around and don't see any obvious explanations of what is going wrong. Figured I'd ask if anyone else is having similar trouble first before further troubleshooting.

Thank you!

andrewteal commented 3 years ago

Update -- should have been more thorough in looking at closed issues on here. Again, coding is but a hobby, so my apologies. I have since updated myfitnesspal to 1.16.4 and it's working like a charm again.

Thanks everyone.