Sync your google fit calories and weight to fitlegit to calculate your actual TDEE.
mkvirtualenv googlefit_to_fitlegit
pip install -r requirements.txt
- Hit the Google Dev Console. Depending on how many google accounts you auth with, you may have to specify the user in the URL parameters. ie.
&authuser=1
for the second authenticated user. - Click
Continue
. Then selectGo to credentials
and selectClient ID
- Under
Where will you be calling the API from?
, selectOther UI
, underWhat data will you be accessing?
, selectUser data
, and hitWhat credentials will I need?
- Name your client,
googlefit_to_fitlegit
works. - Under
Set up the OAuth 2.0 consent screen
, select your email address, and pick a product name to show,googlefit_to_fitlegit
works. HitContinue
. - Note your
client id
. Download the.json
file with your creds. HitDone
. - Authenticate with your google account with the info you just downloaded. This is an interactive authentication that spins up a browser window. This process will generate a
google.json
file with an access and refresh token. The python client will take care of refreshing your access token whenever you run it. The implication is that it runs just fine in a scheduled and unattended job after first auth../auth.py <client id> <secret>
- set
FITLEGIT_USER
andFITLEGIT_PASS
environment variables with any method that suites you. ./sync.py
- Enjoy!
If you want to schedule a job within *nix, use cron. If you want to do the same within OS X, you'll have to use launchctl. I've included a googlefit_to_fitlegit.plist
template file to get you started. You'll need to:
- Modify
googlefit_to_fitlegit.plist
to suit your paths and run time. - Create a
googlefit_to_fitlegit.sh
file that the plist file executes that runs./sync
with the appropriate python/system environment. - Place the file in
~/Library/LaunchAgents
- Load it via
launchctl load ~/Library/LaunchAgents/googlefit_to_fitlegit.plist
- Fire it up via
launchctl start googlefit_to_fitlegit