coddingtonbear / python-myfitnesspal

Access your meal tracking data stored in MyFitnessPal programatically
MIT License
795 stars 139 forks source link

Added keyring ability to Client to make login easier #18

Closed jat255 closed 8 years ago

jat255 commented 9 years ago

Hi there,

I added a little bit to client.py that will attempt to use the python-keyring library to get the password for the user. That way a new client can be created with

client = myfitnesspal.Client('username', '')

and a password doesn't have to be stored in any scripts. If keyring isn't installed, it just falls back to the original behavior. I'm not sure if this is something that would be of interest to you or not, but I figured I'd send it along just in case.

To add your password to the keyring, you would do the following (one-time):

import keyring
keyring.set_password('myfitnesspal', 'username', 'password')
coddingtonbear commented 8 years ago

Thanks for your contribution, @jat255; I've merged your changes (with modification) in bf25b638cc62e4e107b84cb37dc5dbdcdbf2f4b9 and keyring support will go out in the next release.

Cheers!